jprante / elasticsearch-jdbc

JDBC importer for Elasticsearch
Apache License 2.0
2.84k stars 710 forks source link

Error with Elasticsearch River SQL Server integration #678

Open senz79 opened 8 years ago

senz79 commented 8 years ago

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(SimpleRiverSource.java:353) at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow.fetch(SimpleRiverFlow.java:226) at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow.execute(SimpleRiverFlow.java:152) at org.xbib.elasticsearch.plugin.jdbc.RiverPipeline.request(RiverPipeline.java:88) at org.xbib.elasticsearch.plugin.jdbc.RiverPipeline.call(RiverPipeline.java:66) at org.xbib.elasticsearch.plugin.jdbc.RiverPipeline.call(RiverPipeline.java:30) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1516) at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1485) at com.mysql.jdbc.RowDataDynamic.close(RowDataDynamic.java:191) at com.mysql.jdbc.ResultSetImpl.realClose(ResultSetImpl.java:7466) at com.mysql.jdbc.ResultSetImpl.close(ResultSetImpl.java:881) at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.close(SimpleRiverSource.java:842) at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.execute(SimpleRiverSource.java:422) at org.xbib.elasticsearch.river.jdbc.strategy.simple.SimpleRiverSource.fetch(SimpleRiverSource.java:332)

River Plugin used

plugin=org.xbib.elasticsearch.plugin.jdbc.river.JDBCRiverPlugin version=1.5.0.5 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

jprante commented 8 years ago

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 https://github.com/jprante/elasticsearch-jdbc#stored-procedures-or-callable-statements

If you post your current specification, I could suggest how to change that.

jprante commented 8 years ago

You mention SQL server but the stack trace you have shown is from MySQL.

Maybe you can sort this error out, check if there is a mysql driver jar in the lib folder

bigbangtomato commented 8 years ago

@senz79 I encountered the same issue and I fixed it tonight after upgrade mysql-connector-java to 5.1.38 from 5.1.6. good luck.