How to connect remotely to mySQL from eclipse IDE



I am playing around with db based websites. (I know that dh does not support Java). I am trying to access my mySQL db hosted by dh from a java project on my local machine.

I can access a locally hosted mySQL db with

Connection con = DriverManager.getConnection(“jdbc:mysql//localhost:3306/testdb_2”,“username”, “password”);

How can i access my dh hosted mySQL db (assuming the host name is “” and the db name is “testdb_2”?

Thank you

To clarify: I already allowed my computer’s IP address access to the db. I’m asking for the format of the db source string. I tried (“jdbc:mysql//”,“username”,“password”); but that didn’t work. This is more of a jdbc question specific to dh. I believe all of the configurations on the dh side are already set up.


Goodies > MySQL Databases

  • Click the username in the second row.

  • Add your computer’s public IP to Allowable Hosts


Unless you’ve specifically set it up in the past, you’ll need to allow access to this MySQL database from your IP address. By default, it’s locked down to DreamHost machines only.

You can set this up in the MySQL Databases section of the panel. Click the name of the MySQL user (which will appear next to the database it’s associated with), and add your current IP address to the “Allowable Hosts” section. Keep in mind that your IP address may not be fixed; you might have to come back and update this bit occasionally.


In case anyone ever has the same issue, I have found the solution.

db name: testdb_2
password: password

String url = “jdbc:mysql://”;

Connection con = DriverManager.getConnection(url, “admin”, “password”);