# JDBC River for mysql

**URL:** <https://discuss.elastic.co/t/jdbc-river-for-mysql/38847>\
**Category:** Elasticsearch\
**Created:** [January 11, 2016, 8:37am UTC](https://discuss.elastic.co/t/jdbc-river-for-mysql/38847 "2016-01-11T08:37:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [January 11, 2016, 8:37am UTC](https://discuss.elastic.co/t/jdbc-river-for-mysql/38847/1 "2016-01-11T08:37:25Z")

</div>

Hi,  
**My operating system:** Linux Centos.  
**My platform:** Elasticsearch 2.1.0.0 marvel plugin  
**My JDBC River plugin:** elasticsearch-jdbc-2.1.0.0  
**My Mysql database :** admin\_ihale  
**My table:** tbl\_ihale

\*\*I tried. My codes :

PUT /orders/order/1  
{}

PUT /\_river/my\_jdbc\_river/\_meta  
{  
"type": "jdbc",  
"jdbc": {  
"strategy": "simple",  
"digesting": true,  
"fetchsize": "50",  
"driver": "com.mysql.jdbc.Driver",  
"url": "jdbc:mysql://localhost:3306/admin\_ihale",  
"user": "admin\_ihale",  
"password": "admin\_ihale",  
"sql": [  
{  
"statement": "select \* from tbl\_ihale where id = ?",  
"parameter": [  
"1001",  
"US"  
]  
}  
],  
"index": "orders",  
"type": "order",  
"schedule": "0 \*/5 0-23 ? \* \*\* \*"  
},"index": {  
"index": "orders",  
"type": "order",  
"versioning": true  
}}

**My error:**  
{  
"error": {  
"root\_cause": [  
{  
"type": "invalid\_index\_name\_exception",  
"reason": "Invalid index name [_river], must not start with '_'",  
"index": "\_river"  
}  
],  
"type": "invalid\_index\_name\_exception",  
"reason": "Invalid index name [_river], must not start with '_'",  
"index": "\_river"  
},  
"status": 400  
}

I want to move my data to elasticsearch. How do I data import from mysql to elasticsearch 2.1.0. Can you help me? I already have a JDBC river. Do I have to download the JDBC driver?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 11, 2016, 8:49am UTC](https://discuss.elastic.co/t/jdbc-river-for-mysql/38847/2 "2016-01-11T08:49:26Z")

</div>

Read the documentation: [https://github.com/jprante/elasticsearch-jdbc](https://github.com/jprante/elasticsearch-jdbc)

Not a river anymore but a standalone application.

Also, you could look at logstash JDBC input.

---

<div class="post-metadata">

**Author:** ![Hilal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hilal/32/7684_2.png) [@Hilal](https://discuss.elastic.co/u/Hilal)\
**Post date:** [January 13, 2016, 11:46am UTC](https://discuss.elastic.co/t/jdbc-river-for-mysql/38847/3 "2016-01-13T11:46:27Z")

</div>

Thank you. I tried but I have error.

**My codes:**  
bin=$JDBC\_IMPORTER\_HOME/bin  
lib=$JDBC\_IMPORTER\_HOME/lib  
echo '{  
"type" : "jdbc",  
"jdbc" : {  
"url" : "jdbc:mysql://localhost:3306/admin\_ihale",  
"user" : "admin\_ihale",  
"password" : "admin\_ihale",  
"sql" : "select _, id as id from tbl\_ihale"  
}  
}' | java   
-cp "${lib}/_"   
-Dlog4j.configurationFile=${bin}/log4j2.xml   
org.xbib.tools.Runner   
org.xbib.tools.JDBCImporter  
**My error:**  
Could not find or load main class org.xbib.tools.Runner

---

<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:24pm UTC](https://discuss.elastic.co/t/jdbc-river-for-mysql/38847/4 "2017-07-05T23:24:57Z")

</div>


