Error with MySql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vincedav31
    New Member
    • Jul 2007
    • 1

    #1

    Error with MySql

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

    Code:
    Class.forName("com.mysql.jdbc.Driver");
    String DBurl = "jdbc:mysql://138.63.222.7:3306/ns3";
    m_connection = DriverManager.getConnection(DBurl,"root","");
    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. CommunicationsE xception: Communications link failure due to underlying exception:

    ** BEGIN NESTED EXCEPTION **

    java.net.Connec tException
    MESSAGE: Connection timed out: connect

    STACKTRACE:
    java.net.Connec tException: Connection timed out: connect
    at java.net.PlainS ocketImpl.socke tConnect(Native Method)
    at java.net.PlainS ocketImpl.doCon nect(Unknown Source)
    at java.net.PlainS ocketImpl.conne ctToAddress(Unk nown Source)
    at java.net.PlainS ocketImpl.conne ct(Unknown Source)
    at java.net.SocksS ocketImpl.conne ct(Unknown Source)
    at java.net.Socket .connect(Unknow n Source)
    at java.net.Socket .connect(Unknow n Source)
    at java.net.Socket .<init>(Unknow n Source)
    at java.net.Socket .<init>(Unknow n Source)
    at com.mysql.jdbc. StandardSocketF actory.connect( StandardSocketF actory.java:256 )
    at com.mysql.jdbc. MysqlIO.<init>( MysqlIO.java:27 1)
    at com.mysql.jdbc. Connection.crea teNewIO(Connect ion.java:2744)
    at com.mysql.jdbc. Connection.<ini t>(Connection.j ava:1553)
    at com.mysql.jdbc. NonRegisteringD river.connect(N onRegisteringDr iver.java:285)
    at java.sql.Driver Manager.getConn ection(Unknown Source)
    at java.sql.Driver Manager.getConn ection(Unknown Source)
    at ConnexionMdb.ou vrirConnexion(C onnexionMdb.jav a:16)
    at ConnexionMdb.ex ecuteRequeteSel ect(ConnexionMd b.java:101)
    at ParamDao.get(Pa ramDao.java:19)
    at TestConnexion.i nit(TestConnexi on.java:30)
    at sun.applet.Appl etPanel.run(Unk nown Source)
    at java.lang.Threa d.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
  • madhoriya22
    Contributor
    • Jul 2007
    • 251

    #2
    Originally posted by vincedav31
    I have a connection to a server and my database. I use it like this in my code :

    Code:
    Class.forName("com.mysql.jdbc.Driver");
    String DBurl = "jdbc:mysql://138.63.222.7:3306/ns3";
    m_connection = DriverManager.getConnection(DBurl,"root","");
    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. CommunicationsE xception: Communications link failure due to underlying exception:

    ** BEGIN NESTED EXCEPTION **

    java.net.Connec tException
    MESSAGE: Connection timed out: connect

    STACKTRACE:
    java.net.Connec tException: Connection timed out: connect
    at java.net.PlainS ocketImpl.socke tConnect(Native Method)
    at java.net.PlainS ocketImpl.doCon nect(Unknown Source)
    at java.net.PlainS ocketImpl.conne ctToAddress(Unk nown Source)
    at java.net.PlainS ocketImpl.conne ct(Unknown Source)
    at java.net.SocksS ocketImpl.conne ct(Unknown Source)
    at java.net.Socket .connect(Unknow n Source)
    at java.net.Socket .connect(Unknow n Source)
    at java.net.Socket .<init>(Unknow n Source)
    at java.net.Socket .<init>(Unknow n Source)
    at com.mysql.jdbc. StandardSocketF actory.connect( StandardSocketF actory.java:256 )
    at com.mysql.jdbc. MysqlIO.<init>( MysqlIO.java:27 1)
    at com.mysql.jdbc. Connection.crea teNewIO(Connect ion.java:2744)
    at com.mysql.jdbc. Connection.<ini t>(Connection.j ava:1553)
    at com.mysql.jdbc. NonRegisteringD river.connect(N onRegisteringDr iver.java:285)
    at java.sql.Driver Manager.getConn ection(Unknown Source)
    at java.sql.Driver Manager.getConn ection(Unknown Source)
    at ConnexionMdb.ou vrirConnexion(C onnexionMdb.jav a:16)
    at ConnexionMdb.ex ecuteRequeteSel ect(ConnexionMd b.java:101)
    at ParamDao.get(Pa ramDao.java:19)
    at TestConnexion.i nit(TestConnexi on.java:30)
    at sun.applet.Appl etPanel.run(Unk nown Source)
    at java.lang.Threa d.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

    Comment

    Working...