how to fix jdbc connection when SQLstate 08S01

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

[1692 byte] By [Zdravkoa] at [2007-11-27 6:17:51]
# 1
Try to connect to the server in another way (such as telnet). See if you can connect to port 3306. If not, the port is blocked or there's nobody listening (is there a mysql server running on the host?).
-Kayaman-a at 2007-7-12 17:31:11 > top of Java-index,Java Essentials,Java Programming...
# 2
You are right! Port 3306 is blocked. Thank you very much!
Zdravkoa at 2007-7-12 17:31:11 > top of Java-index,Java Essentials,Java Programming...