How to connect to a remote database using JDBC?

I am trying to connect to a remote database through JDBC. Here is my connection string:

db=mysql://user: password@blablabla.rds.amazonaws.com /dbname 

At first glance it seems that it should work, but when trying to get it an error:

 Cannot connected to the database, An attempt by a client to checkout a Connection has timed out. 

I am trying to use Play framework (1.2.x) and have described this db connection in the conf file.

Any ideas?

+4
source share
2 answers

Following the duffymo command, the line you want to use is jdbc:mysql://blablabla.rds.amazonaws.com/dbname?user=user&password=password , as described here

+3
source

Yes, this is the wrong URL.

You need the MySQL Connector-J JDBC JAR driver in your CLASSPATH.

The url should look like this:

http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html

I would recommend not putting credentials in the url. Add them to Java.

If you get an error, send a stack trace. This will help diagnose what you did wrong.

Can you connect to this database using the MySQL administration tool? Can you ping this server? Can you connect to this port? If not, Java will not connect either. Is there a firewall between your client machine and the database server? If so, then the MySQL port should be open for you.

+3
source

All Articles