Can connect to remote database through MySQL Workbench, but not Java JBDC

Junior

New Member
I have a remote MySQL database that I can connect to with MySQL Workbench (screen shot below), but I ultimately need to connect to it via JBDC and everytime I try to connect, it throws an exception. I'm new to this, so could anyone provide me some insight on what could be wrong?\[code\]String host = "testdb.db.10682960.hostedresource.com";String datab = "testdb";String url = "jdbc:mysql://" + host + ":3306/" + datab;Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection(url, datab, "password");\[/code\]com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
YgIzvIa.png
 
Back
Top