Monday, July 27, 2009

Trouble in connecting jdbc with my sql server5.0 can anyone help?

error in db connectioncom.mysql.jdbc.exceptions.jdbc... C


ommunications link failure





Last packet sent to the server was 15 ms ago.


com.mysql.jdbc.exceptions.jdbc4.Commun... Communications link fai


lure





Last packet sent to the server was 15 ms ago.


at sun.reflect.NativeConstructorAccessorImp... Method)





at sun.reflect.NativeConstructorAccessorImp...


orAccessorImpl.java:39)


at sun.reflect.DelegatingConstructorAccesso...


onstructorAccessorImpl.java:27)


at java.lang.reflect.Constructor.newInstanc...


at com.mysql.jdbc.Util.handleNewInstance(Ut...


at com.mysql.jdbc.SQLError.createCommunicat...


074)


at com.mysql.jdbc.ConnectionImpl.createNewI...


at com.mysql.jdbc.ConnectionImpl.%26lt;init%26gt;(Con...


at com.mysql.jdbc.JDBC4Connection.%26lt;init%26gt;(JD...


at sun.reflect.NativeConstructorAccessorImp... Method)





at sun.reflect.NativeConstructorAccessorImp...


orAccessorImpl.java:39)


at sun.reflect.DelegatingConstructorAccesso...


onstructorAccessorImpl.java:27)


at java.lang.reflect.Constructor.newInstanc...


at com.mysql.jdbc.Util.handleNewInstance(Ut...


at com.mysql.jdbc.ConnectionImpl.getInstanc...


at com.mysql.jdbc.NonRegisteringDriver.conn...


:282)


at java.sql.DriverManager.getConnection(Dri...


at java.sql.DriverManager.getConnection(Dri...


at DatabaseConnection.%26lt;init%26gt;(DatabaseConnec...


at ServiceProvider_Frame.%26lt;init%26gt;(ServiceProv...


at ServiceProvider_Frame.main(ServiceProvid...


Caused by: java.net.ConnectException: Connection refused: connect


at java.net.PlainSocketImpl.socketConnect(N... Method)


at java.net.PlainSocketImpl.doConnect(Plain...


at java.net.PlainSocketImpl.connectToAddres...


at java.net.PlainSocketImpl.connect(PlainSo...


at java.net.SocksSocketImpl.connect(SocksSo...


at java.net.Socket.connect(Socket.java:518)


at java.net.Socket.connect(Socket.java:468)


at java.net.Socket.%26lt;init%26gt;(Socket.java:365)


at java.net.Socket.%26lt;init%26gt;(Socket.java:208)


at com.mysql.jdbc.StandardSocketFactory.con...


va:253)


at com.mysql.jdbc.MysqlIO.%26lt;init%26gt;(MysqlIO.ja...


at com.mysql.jdbc.ConnectionImpl.createNewI...


... 14 more

Trouble in connecting jdbc with my sql server5.0 can anyone help?
The error is "Connection refused" which means the connection port is not open due to mysql server is not listening on that port, or mysql died and is no longer listening on that port. Best way to find out is use the telnet command: telnet %26lt;mysqlURL%26gt; %26lt;mySqlPort%26gt;





example:


telnet mysqlServer 5984





If you get a blank screen on your command prompt, then connection is fine. Any other messages will be connection errors


No comments:

Post a Comment