# \[ERROR\] Logstash JDBC plugin - PKIX path building failed

**URL:** <https://discuss.elastic.co/t/error-logstash-jdbc-plugin-pkix-path-building-failed/298439>\
**Category:** Logstash\
**Tags:** jdbc\
**Created:** [February 28, 2022, 6:25pm UTC](https://discuss.elastic.co/t/error-logstash-jdbc-plugin-pkix-path-building-failed/298439 "2022-02-28T18:25:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rossana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rossana/32/94216_2.png) [@Rossana](https://discuss.elastic.co/u/Rossana)\
**Post date:** [February 28, 2022, 6:25pm UTC](https://discuss.elastic.co/t/error-logstash-jdbc-plugin-pkix-path-building-failed/298439/1 "2022-02-28T18:25:29Z")

</div>

Hi,

I have an issue with logstash jdbc plugin configuration for MSSQL.

My config file:

```auto
input {
    jdbc {
      jdbc_driver_library => "/opt/elastic/drivers/mssql-jdbc-10.2.0.jre11.jar"
      jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
      jdbc_connection_string => "jdbc:sqlserver://0.0.0.0:1433;databaseName=solarwindsbd_rst;"
      jdbc_user => "user_elk"
      jdbc_password => "pass"
      statement => "SELECT SYSDATETIME() \"SYSDATETIME\",CURRENT_TIMESTAMP\"CURRENT\",GETDATE()\"GET\";"
      jdbc_validate_connection => true
    }
}
filter {

}
output {
  #elasticsearch {
  # hosts => ["clusterECS"]
  # user => "elastic"
  # password => "pass"
  # index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{[alp]}-%{+YYYY.MM}"
  #}
  stdout { codec => rubydebug }
}

```

I had an error before this one and I dont know if it is related  
Error 1:

```auto
jdbc - Unable to connect to database. 
Tried 1 times {:message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: 
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: \"The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]\". 
ClientConnectionId:80248a28-d90c-4b17-ab28-28ea9186c3dd", :
exception=>Sequel::DatabaseConnectionError, :
cause=>com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: "The server selected protocol version TLS10 is not accepted by client preferences [TLS13, TLS12]". ClientConnectionId:80248a28-d90c-4b17-ab28-28ea9186c3dd, :backtrace=>["com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3680)", "com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(com/microsoft/sqlserver/jdbc/IOBuffer.java:2113)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3204)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.login(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2833)", "com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:2671)",

```

For resolve this error I change the java.security file  
From this:

```auto
jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves

```

To this:

```auto
jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \
    DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
    include jdk.disabled.namedCurves

```

**After this change the error is this:**

```auto
[ERROR] 2022-02-28 12:40:13.792 [[main]<jdbc] jdbc - Unable to connect to database. 
Tried 1 times {:message=>"Java::ComMicrosoftSqlserverJdbc::SQLServerException: 
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
**Error: \"PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target\".**
 **ClientConnectionId:f79ffae4-4161-469a-bdab-b9997ccdb3c7"** , :exception=>Sequel::DatabaseConnectionError, :
cause=>com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. 
Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: 
unable to find valid certification path to requested target". ClientConnectionId:f79ffae4-4161-469a-bdab-b9997ccdb3c7,
 :backtrace=>["com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(com/microsoft/sqlserver/jdbc/SQLServerConnection.java:3680)", "com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(com/microsoft/sqlserver/jdbc/IOBuffer.java:2113)"

```

Do you know which could be the cause of this error??

Regards,

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2022, 6:26pm UTC](https://discuss.elastic.co/t/error-logstash-jdbc-plugin-pkix-path-building-failed/298439/2 "2022-03-28T18:26:06Z")

</div>

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