471,602 Members | 1,242 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,602 software developers and data experts.

Error with MySql

I have a connection to a server and my database. I use it like this in my code :

Expand|Select|Wrap|Line Numbers
  1. Class.forName("com.mysql.jdbc.Driver");
  2. String DBurl = "jdbc:mysql://138.63.222.7:3306/ns3";
  3. m_connection = DriverManager.getConnection(DBurl,"root",""); 
  4.  
It works fine if I start the applet on the server but not on a distant computer. I have a timeout error :

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection timed out: connect

STACKTRACE:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2744)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ConnexionMdb.ouvrirConnexion(ConnexionMdb.java:16)
at ConnexionMdb.executeRequeteSelect(ConnexionMdb.jav a:101)
at ParamDao.get(ParamDao.java:19)
at TestConnexion.init(TestConnexion.java:30)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

** END NESTED EXCEPTION **

Last packet sent to the server was 0 ms ago.

If someone have an idea how to solve this problem. Thanks in advance
Jul 30 '07 #1
1 1799
madhoriya22
252 100+
I have a connection to a server and my database. I use it like this in my code :

Expand|Select|Wrap|Line Numbers
  1. Class.forName("com.mysql.jdbc.Driver");
  2. String DBurl = "jdbc:mysql://138.63.222.7:3306/ns3";
  3. m_connection = DriverManager.getConnection(DBurl,"root",""); 
  4.  
It works fine if I start the applet on the server but not on a distant computer. I have a timeout error :

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.ConnectException
MESSAGE: Connection timed out: connect

STACKTRACE:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at com.mysql.jdbc.StandardSocketFactory.connect(Stand ardSocketFactory.java:256)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
at com.mysql.jdbc.Connection.createNewIO(Connection.j ava:2744)
at com.mysql.jdbc.Connection.<init>(Connection.java:1 553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonReg isteringDriver.java:285)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ConnexionMdb.ouvrirConnexion(ConnexionMdb.java:16)
at ConnexionMdb.executeRequeteSelect(ConnexionMdb.jav a:101)
at ParamDao.get(ParamDao.java:19)
at TestConnexion.init(TestConnexion.java:30)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

** END NESTED EXCEPTION **

Last packet sent to the server was 0 ms ago.

If someone have an idea how to solve this problem. Thanks in advance
Hi,
It means that ur 'distant computer' is not responding right now. It is not able to connect to remote address or port.
Make sure u r providing right IP address.
Thanks and regards,
madhoriya
Jul 30 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Wayno | last post: by
reply views Thread by Ola Ogunneye | last post: by
reply views Thread by Morten Gulbrandsen | last post: by
reply views Thread by Morten Gulbrandsen | last post: by
1 post views Thread by Steve Ametjan | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.