# Update Mechanisam for Jdbc plugin and elasticsearch

**URL:** <https://discuss.elastic.co/t/update-mechanisam-for-jdbc-plugin-and-elasticsearch/8649>\
**Category:** Elasticsearch\
**Created:** [August 6, 2012, 3:49pm UTC](https://discuss.elastic.co/t/update-mechanisam-for-jdbc-plugin-and-elasticsearch/8649 "2012-08-06T15:49:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sowmyak](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@sowmyak](https://discuss.elastic.co/u/sowmyak)\
**Post date:** [August 6, 2012, 3:49pm UTC](https://discuss.elastic.co/t/update-mechanisam-for-jdbc-plugin-and-elasticsearch/8649/1 "2012-08-06T15:49:53Z")

</div>

Hi,

I have a problem using JDBC plugin with elasticsearch and mysql.  
I am able to poll and retrieve the values using Polling.

But, When I am using the method of Updating Mechanisms, I am not able to index the values into ElasticSearch.

when I am using -XGET to retrieve the indexes, it is giving me 0 hits.

This is the procedure that I have followed for getting my updates on mysql table reflected on elasticsearch index.

Step 1: create table class\_info(rno int, name varchar(100)); //Create a table in mysql database  
Step 2 : create table my\_jdbc\_river(\_index varchar(64), \_type varchar(64), \_id varchar(64), source\_timestamp timestamp not null default current\_timestamp, source\_operation varchar(8), source\_sql varchar(255), target\_timestamp timestamp, target\_operation varchar(8) default 'n/a', target\_failed boolean, target\_message varchar(255), primary key(\_index, \_type, \_id, source\_timestamp, source\_operation));  
//create a river table in mysql database

Step 3: Create a trigger on class\_info table to insert the rows into my\_jdbc\_river on insert operation  
delimiter $$

create trigger check\_root after insert on class\_info for each row begin insert into my\_jdbc\_river values("index", "type", "id", null, 'create', 'select \* from check\_es', null, null, true, null); end$$

delimiter ;

I am not sure whether the parameters to insert statement are correct or not.

Step 4: Create a river on ElasticSearch  
curl -XPUT 'localhost:9200/\_river/my\_jdbc\_river/\_meta' -d '{ "type" : "jdbc", "jdbc" : { "driver" : "com.mysql.jdbc.Driver", "url" : "jdbc:mysql://localhost:3306/testes", "user" : "root", "password" : "p00ph34d", "poll" : "300s","rivertable" : true, "interval" : "305s" }, "index" : { "index" : "jdbc","type" : "jdbc", "bulk\_size" : 100,"max\_bulk\_requests" : 30, "bulk\_timeout" : "60s"} }'

And, when i am inserting the values into class\_info they are not being indexed in elasticsearch.

Please let me know the correct procedure I am missing anything or misunderstood the concept.

Thanks!

---

<div class="post-metadata">

**Author:** ![sowmyak](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@sowmyak](https://discuss.elastic.co/u/sowmyak)\
**Post date:** [August 6, 2012, 4:01pm UTC](https://discuss.elastic.co/t/update-mechanisam-for-jdbc-plugin-and-elasticsearch/8649/2 "2012-08-06T16:01:59Z")

</div>

Hi,

Please let me know if you have any questions regarding my doubt.

--  
View this message in context: [http://elasticsearch-users.115913.n3.nabble.com/Update-Mechanisam-for-Jdbc-plugin-and-elasticsearch-tp4021313p4021318.html](http://elasticsearch-users.115913.n3.nabble.com/Update-Mechanisam-for-Jdbc-plugin-and-elasticsearch-tp4021313p4021318.html)  
Sent from the ElasticSearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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 6, 2017, 3:17am UTC](https://discuss.elastic.co/t/update-mechanisam-for-jdbc-plugin-and-elasticsearch/8649/3 "2017-07-06T03:17:36Z")

</div>


