# Not able to use insert sql query in jdbc\_streaming filter

**URL:** <https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725>\
**Category:** Logstash\
**Created:** [February 9, 2021, 12:35pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725 "2021-02-09T12:35:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melvin\_Shaju](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melvin_shaju/32/82760_2.png) [@Melvin\_Shaju](https://discuss.elastic.co/u/Melvin_Shaju)\
**Post date:** [February 9, 2021, 12:35pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725/1 "2021-02-09T12:35:42Z")

</div>

When I tried to insert some in local mysql using jdbc\_streaming filter, it is showing following error. But no error is shown for select statements.  
Ruby-0-Thread-12@[main]\>worker6: :1] jdbcstreaming - Exception when executing JDBC query {:exception=\>#\<Sequel::DatabaseError: Java::JavaSql::SQLException: Can not issue data manipulation statements with executeQuery().\>}.

Following is the realted part of my configuration file

```auto
jdbc_streaming {
		jdbc_driver_library => "${MYSQL_DRIVER_PATH}"
		jdbc_driver_class => "${JDBC_DRIVER}"
		jdbc_connection_string => "${JDBC_CONNECTION_STRING}"
		jdbc_user => "${DB_USERNAME}"
		jdbc_password => "${DB_PASSWORD}"
		statement => "INSERT INTO rcyc_audit(job_id, process_name, description) VALUES(job_id, process_name, description);"
		parameters => { "jobId" => "jobId"
						"process" => "process"
						"description" => "@metadata[RegionStarted]"
					}
		target => "audit_id"
	}

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 9, 2021, 4:37pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725/2 "2021-02-09T16:37:48Z")

</div>

> [@Melvin\_Shaju](#):
>
> Java::JavaSql::SQLException: Can not issue data manipulation statements with executeQuery()

Apparently the jdbc\_streaming filter executes an executeQuery call to the jdbc driver. An executeQuery call executes a query that returns a ResultSet. An executeUpdate call should be used to do an INSERT or other call that does not return a ResultSet. Some drivers enforce this distinction, some do not. For example, the last time I checked (which was nearly 20 years ago) Sybase did not care but DB2 did.

---

<div class="post-metadata">

**Author:** ![Melvin\_Shaju](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/melvin_shaju/32/82760_2.png) [@Melvin\_Shaju](https://discuss.elastic.co/u/Melvin_Shaju)\
**Post date:** [February 9, 2021, 4:56pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725/3 "2021-02-09T16:56:00Z")

</div>

Thanks for your feedback.. But how can I make executeUpdate call inside jdbc\_streaming filter? Please help. I'm new to logstash.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [February 9, 2021, 4:57pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725/4 "2021-02-09T16:57:37Z")

</div>

> [@Melvin\_Shaju](#):
>
> But how can I make executeUpdate call inside jdbc\_streaming filter?

I do not think that is supported. The filter is documented as "executes a SQL query and store the result set".

---

<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 9, 2021, 4:58pm UTC](https://discuss.elastic.co/t/not-able-to-use-insert-sql-query-in-jdbc-streaming-filter/263725/5 "2021-03-09T16:58:06Z")

</div>

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