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