Why I am getting this error when using JDBC input plugin of Logstash

I would ignore the error. It tries to do a count, if it fails then it stops trying. More details here.