# Error with Elasticsearch River SQL Server integration

**URL:** <https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045>\
**Category:** Elasticsearch\
**Created:** [October 27, 2015, 5:23am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045 "2015-10-27T05:23:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Senz79](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senz79/32/42874_2.png) [@Senz79](https://discuss.elastic.co/u/Senz79)\
**Post date:** [October 27, 2015, 5:23am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/1 "2015-10-27T05:23:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 27, 2015, 5:34am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/2 "2015-10-27T05:34:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Senz79](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senz79/32/42874_2.png) [@Senz79](https://discuss.elastic.co/u/Senz79)\
**Post date:** [October 27, 2015, 5:38am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/3 "2015-10-27T05:38:00Z")

</div>

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.

Thanks  
Senz

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [October 27, 2015, 7:56am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/4 "2015-10-27T07:56:25Z")

</div>

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

You can also open issues at [https://github.com/jprante/elasticsearch-jdbc/issues/](https://github.com/jprante/elasticsearch-jdbc/issues/) if you need help for JDBC importer/river.

---

<div class="post-metadata">

**Author:** ![Senz79](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senz79/32/42874_2.png) [@Senz79](https://discuss.elastic.co/u/Senz79)\
**Post date:** [October 27, 2015, 10:29am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/5 "2015-10-27T10:29:04Z")

</div>

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

> **[INSERT INTO LOGSTASH SELECT DATA FROM DATABASE
	  	 | Elastic](https://www.elastic.co/blog/logstash-jdbc-input-plugin)**
>
> Ever want to search your database entities from Elasticsearch? Now you can use Logstash to do just that! In this blog we introduce the JDBC input, which has been created to import data ...

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://xxx.xxx.xxx.xxx:1433;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 => "com.microsoft.sqlserver.jdbc.sqlserverdriver"
	schedule => "0 0/2 * * * *"
    statement => "select count(1) as count from [Tutoring].[tblAppointmentExtendedProperties]"
}

```

}  
output {  
elasticsearch {  
protocol =\> http  
index =\> "epsusage"  
document\_type =\> "epsusage"  
host =\> "xxx.xxx.xxx.xxx"  
port =\> "9200"  
}  
stdout { codec =\> rubydebug }  
}

---

<div class="post-metadata">

**Author:** ![Senz79](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/senz79/32/42874_2.png) [@Senz79](https://discuss.elastic.co/u/Senz79)\
**Post date:** [October 27, 2015, 10:33am UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/6 "2015-10-27T10:33:11Z")

</div>

Hey Jorg  
i have raised the issue

> <https://github.com/jprante/elasticsearch-jdbc/issues/678>

Please help

---

<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:** [July 5, 2017, 11:42pm UTC](https://discuss.elastic.co/t/error-with-elasticsearch-river-sql-server-integration/33045/7 "2017-07-05T23:42:28Z")

</div>


