I have try following config and it works with
java 8 and sqljdbc4.2
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_driver_library => "/root/sqljdbc_4.2/enu/jre8/sqljdbc42.jar"
what I want to do is use jdk12 and sqljdbc7.4
Microsoft JDBC Driver 7.4 for SQL Server
downloaded
make sure java is 12
#> java -version
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
but it fails saying
Error: com.mysql.jdbc.Driver not loaded. :jdbc_driver_library is not set, are you sure you included
the proper driver client libraries in your classpath?
if I use
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
it still says
Error: com.microsoft.sqlserver.jdbc.SQLServerDriver not loaded. :jdbc_driver_library is not set, are you sure you included
the proper driver client libraries in your classpath?
it seems like only classpath problem?
anyone has test this?
oh well fixed it. Looks like I have to use mysql-jdbc-7.4.1.jre8.jar with openjdk12 and it works.
it does not work if I use mysql-jdbc-7.4.1.jre12.jar
basically I had two copy in
/usr/share/logstash/logstash-core/lib/jars/sqljdbc42.jar
/usr/share/logstash/logstash-core/lib/jars/mssql-jdbc-7.4.1.jre8.jar
remove old one
now I have following. if anyone has such problem they can check.
ls -la /usr/share/logstash/logstash-core/lib/jars/mssql-jdbc-7.4.1.jre8.jar
-rw-r--r-- 1 root root 1209659 Sep 17 12:21 /usr/share/logstash/logstash-core/lib/jars/mssql-jdbc-7.4.1.jre8.jar
java -version
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)
using openjdk12 provided by elasticsearch
ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 37 Sep 17 12:27 /etc/alternatives/java -> /usr/share/elasticsearch/jdk/bin/java
And finally config file
input {
jdbc {
jdbc_validate_connection => false
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://server_name;databaseName=db1;user=myuser;password=password;"
jdbc_user => "myser"
jdbc_password => "password"
statement => "select * from db1"
clean_run=>true
}
}