Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to fix jdbc connection when SQLstate 08S01

807606Jun 4 2007 — edited Jun 4 2007
I have an application that connects to and insert into a remote database which runs on a server I connect to over the internet. I tested it on local server (localhost) and it works fine, but when I put my server IP (72.52.155.111) or web domain I can' t connect. I'm not sure what should I write instead localhost: webdomain or something else ?
Java code
...
conn =   DriverManager.getConnection("jdbc:mysql://72.52.155.111:3306/fritaor_apartmani" ,"fritaor_root","10000000");
...
Error code:
SQLException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

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

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection timed out: conne
ct
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
va:156)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
        at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
:266)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at java.sql.DriverManager.getConnection(Unknown Source)
        at Mysql.save(Mysql.java:57)
        at Contact.run(Contact.java:299)
        at Testing.main(Testing.java:21)


** END NESTED EXCEPTION **



Last packet sent to the server was 47 ms ago.
SQLState: 08S01
VendorError: 0
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2007
Added on Jun 4 2007
2 comments
7,584 views