One Liner...

...tujhe bhi apne pe ye aeitbaar hai ki nahi...

Monday, April 14, 2014

Connector/JDBC and Java :: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?

The error arised while connecting to database.

This problem is caused because of connector. I was using mysql-connector-java-2.0.14-bin.jar from java to mysql as connector. But when I updated to mysql-connector-java-3.1.14-bin.jar it started working. 

You can also check in mysql by command "status"
Connection id:          47
Current database:
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.5.21 MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn.  characterset:    latin1
TCP port:               3306
Uptime:                 47 min 32 sec

which did not show any conflict in port. Basically this could had arises due to mysql version i am using and the connector i used to connect with this MySQL.