Error with Elasticsearch River SQL Server integration

(Shantanu Sen) #1

I am getting the below error

SQLException: Connection is read-only. Queries leading to data modification are not allowed.
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.fetch(
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow.fetch(
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow.execute(
at org.xbib.elasticsearch.plugin.jdbc.RiverPipeline.request(
at java.util.concurrent.ThreadPoolExecutor.runWorker(
at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed.
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.StatementImpl.executeUpdate(
at com.mysql.jdbc.StatementImpl.executeUpdate(
at com.mysql.jdbc.RowDataDynamic.close(
at com.mysql.jdbc.ResultSetImpl.realClose(
at com.mysql.jdbc.ResultSetImpl.close(
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.close(
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.execute(
at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.fetch(

River Plugin used

I am running an Select Query to fetch data from SQL Server

I am using the sql server connector - sqljdbc4.jar

Please help me with the error

(Mark Walkom) #2

You should look at using the jdbc input plugin for Logstash, rivers are deprecated.

(Shantanu Sen) #3

Hello Mark
Thanks for the reply. Yes river is deprecated but after 1.5. Now the issue is river is working fine for most of my select query, but one which is creating an issue. In case you want I can share the query.


(Jörg Prante) #4

JDBC importer is not deprecated. It's a community contribution.

For Elasticsearch 1.5 I still support the full river API of JDBC importer/river. It's the same codebase.

The JDBC importer/river uses read-only connections by default. This is for security and performance. The query you are using is not reading but also writing. In that case, you must switch the SQL statement configuration to a callable statement. More information for callable statements at

You can also open issues at if you need help for JDBC importer/river.

(Shantanu Sen) #5

Mark I tried Jdbc input plugin and i followed the below link

Now everything seems correct as I am getting the message "Logstash startup completed"

But nothing seems to happen ... no index created in elasticsearch. I am pasting the conf file here please advice

jdbc {
    jdbc_connection_string => "jdbc:sqlserver://;databaseName=EPS"
    jdbc_user => "myuser"
	jdbc_password => "mypassword"
    jdbc_validate_connection => true
    jdbc_driver_library => "/opt/logstash-1.5.4/bin/sqljdbc4-3.0.jar"
	jdbc_driver_class => ""
	schedule => "0 0/2 * * * *"
    statement => "select count(1) as count from [Tutoring].[tblAppointmentExtendedProperties]"

output {
elasticsearch {
protocol => http
index => "epsusage"
document_type => "epsusage"
host => ""
port => "9200"
stdout { codec => rubydebug }

(Shantanu Sen) #6

Hey Jorg
i have raised the issue

Please help

(system) #7