# Logstash jdbc input output in one conf not working

**URL:** <https://discuss.elastic.co/t/logstash-jdbc-input-output-in-one-conf-not-working/192929>\
**Category:** Logstash\
**Created:** [July 30, 2019, 2:57pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-output-in-one-conf-not-working/192929 "2019-07-30T14:57:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankfoti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frankfoti/32/26965_2.png) [@frankfoti](https://discuss.elastic.co/u/frankfoti)\
**Post date:** [July 30, 2019, 2:57pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-output-in-one-conf-not-working/192929/1 "2019-07-30T14:57:08Z")

</div>

Output works when input is not jdbc but this config ends in error:

[ERROR][org.logstash.Logstash] java.lang.NoClassDefFoundError: Could not initialize class com.mysql.jdbc.PreparedStatement

conf:  
'root@cloudcontrol-logstash:~# cat /etc/logstash/rrc104-production/docs/mysql-docs.conf  
input {  
jdbc {  
jdbc\_driver\_library =\> "/usr/share/logstash/mysql-connector-java-5.1.43-bin.jar"  
jdbc\_driver\_class =\> "com.mysql.jdbc.Driver"  
jdbc\_connection\_string =\> "jdbc:mysql://35.227.67.170:3306/rrdb?&useSSL=false"  
jdbc\_user =\> "ffoti"  
jdbc\_password =\> "ffoti"  
statement =\> "SELECT dr.document\_name document\_name,  
d.document\_id document\_id,  
d.matter\_id matter\_id,  
3 doc\_status\_id,  
d.duplicate\_id duplicate\_id,  
dl.load\_id load\_id,  
dl.load\_status\_id load\_status\_id  
FROM document d,  
document\_load dl,  
document\_report dr  
WHERE dl.load\_id = d.load\_id  
AND d.document\_id = dr.document\_id  
AND dr.status = 'Completed'  
AND duplicate\_id IS NULL"  
jdbc\_paging\_enabled =\> "true"  
jdbc\_page\_size =\> "500000"  
}  
}

filter {  
mutate {  
add\_field =\> { "environment" =\> "rrc104-production" }  
}  
mutate {  
add\_field =\> { "customer\_id" =\> "rrc104" }  
}  
mutate {  
add\_field =\> { "customer\_name" =\> "BSF" }  
}  
mutate {  
add\_field =\> { "project" =\> "rrc104-219321" }  
}  
}

output {  
elasticsearch {  
hosts =\> ["cloudcontrol-elasticsearch1.office.re.local:9200"]  
index =\> "mysql-docs"  
ssl =\> true  
cacert =\> '/etc/logstash/ca.crt'  
sniffing =\> false  
user =\> elastic  
password =\> ra2tional3  
}  
}

output {  
jdbc {  
driver\_jar\_path =\> "/usr/share/logstash/mysql-connector-java-5.1.43-bin.jar"  
driver\_class =\> "com.mysql.jdbc.Driver"  
connection\_timeout =\> 50000  
connection\_string =\> "jdbc:mysql://10.200.2.163:3306/cloudcontrol?user=ffoti&password=ffoti&useSSL=false"  
statement =\> ["INSERT INTO rrc104\_prd\_docs\_mysql\_l(matter\_id,document\_name,document\_id,load\_id,load\_status\_id) values(?,?,?,?,?)","matter\_id","document\_name","document\_id","load\_id","load\_status\_id"]  
}  
}  
'

---

<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 27, 2019, 2:57pm UTC](https://discuss.elastic.co/t/logstash-jdbc-input-output-in-one-conf-not-working/192929/2 "2019-08-27T14:57:13Z")

</div>

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