# Why the input-jdbc plugin automatically converts the MySQL database tinyint data type to boolean type?

**URL:** <https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100>\
**Category:** Logstash\
**Created:** [July 23, 2018, 7:48am UTC](https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100 "2018-07-23T07:48:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scopy](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@Scopy](https://discuss.elastic.co/u/Scopy)\
**Post date:** [July 23, 2018, 7:48am UTC](https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100/1 "2018-07-23T07:48:07Z")

</div>

Hi,everyone!  
I‘m a green hand to logstash.’This is the first attempt to synchronize MySQL data with logstash today.However, when I used the JDBC plugin, it encountered some problems. MySQL data is set to tinyint, it turns to boolean with input-jdbc which I don't expect.  
MySQL data type:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/9/69b05bd8740661ad75963a99387e8efd9be2bcf8.png)  
input-jdbc log:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/9/b9040aa9622a2b545b25c794c83ffe92e34a9988.png)  
What should I do to make it not automatically converted?  
We look forward to your reply, and will be appreciate.

---

<div class="post-metadata">

**Author:** ![guyboertje](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guyboertje/32/31592_2.png) [@guyboertje](https://discuss.elastic.co/u/guyboertje)\
**Post date:** [July 23, 2018, 10:34am UTC](https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100/2 "2018-07-23T10:34:19Z")

</div>

You must CAST it in your SQL statement.

---

<div class="post-metadata">

**Author:** ![Scopy](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@Scopy](https://discuss.elastic.co/u/Scopy)\
**Post date:** [July 24, 2018, 5:46am UTC](https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100/3 "2018-07-24T05:46:34Z")

</div>

Thank you for your reply.I've solved this problem.I added a parameter(tinyInt1isBit=false) to the value of jdbc\_connection\_string, and then it will work properly.

---

<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:** [August 21, 2018, 5:46am UTC](https://discuss.elastic.co/t/why-the-input-jdbc-plugin-automatically-converts-the-mysql-database-tinyint-data-type-to-boolean-type/141100/4 "2018-08-21T05:46:35Z")

</div>

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