Exception when executing JDBC query exception=>Sequel::DatabaseError, :message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: Connection reset", :cause=>"# <Java::ComMicrosoftSqlserverJdbc::SQLServerException: Connection reset

For some time i am able to connect DB but after few seconds i get the error "Exception when executing JDBC query "

My logstash config format:
input {
jdbc {
tags => "index.conf"
jdbc_connection_string => "jdbc:sqlserver://XXXXXXX;databaseName=XXXX;Integrated Security=fale;TrustServerCertificate=true;Connect Timeout=600;Command Timeout=120"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_driver_library => "D:\XXXX\XXXX\lib/mssql-jdbc-12.4.1.jre11.jar"
jdbc_user => "XXXXX"
jdbc_password => "XXXXX"
tracking_column => "modifieddate"
use_column_value => true
jdbc_pool_timeout => 50
jdbc_validate_connection => true
jdbc_validation_timeout =>3600
connection_retry_attempts => 2
tracking_column_type => "timestamp"
schedule => "*/2 * * * *"
statement => "SELECT col1,col2,modifieddate AAA WHERE modifieddate > DATEADD(HH,-1,:sql_last_value)"
last_run_metadata_path => "D:\XXXX\XXXX\configfiles\lastrun/.logstash-8.6.2_jdbc_last_run_index"
}
tcp {
codec => fluent
port => 7000
tcp_keep_alive => true
}
}

filter {
if "index.conf" in [tags]{
mutate {
copy => { "col1" => "[col1]"} }
}
}

output {
if "index.conf" in [tags]{
azuresearch {
endpoint => "XXXcognitivesearchXXXX.XXXX.XXXX.Xet"
api_key => "XXXXXXX"
search_index => "admindata"
column_names => ['col1','col2','modifieddate']

}
}
}

Using below:

  1. MS SQL to connect DB
  2. Logstash 8.6.2
  3. output- Azure cognitive search index.

Approaches Tried:

  1. Increased connection timeout in connection string.
  2. Added jdbc connection pool timeout
  3. connection retry

There is no article for this issue to fix. Can anyone pls let me know hot to fix this issue?

Can anyone please share your inputs on this issue?

The sql query executes in max 4 seconds. Logstash scehduler is set for every 2 mins but still the connection reset issue exists.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.