Click to See Complete Forum and Search --> : How to connect to MySQL on a remote server?


hcarousel
08-01-2006, 02:37 PM
What I want to do is to connect to an MySQL database on a remote server. The following is my code.

Connection con;

Class.forName("org.gjt.mm.mysql.Driver").newInstance();

con = DriverManager.getConnection("jdbc:mysql://remoteserver:3306/mydatabase", "root", "password");

I got com.mysql.jdbc.CommunicationsException. Can somebody please tell me how to correct this error?

Thanks!

Khalid Ali
08-01-2006, 09:42 PM
read the sticky at the top of these forums, there is helpfull info there for this very purpose.
sticky here (http://www.webdeveloper.com/forum/showthread.php?t=44232)