Can someone explain to me why this line works:
conn = DriverManager.getConnection("jdbc:mysql://myWebsite.com:3306/schemaName?user=userX&password=passwordX"); But this line does not:
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/schemaName?user=userX&password=passwordX"); I get a Communications Link Failure when attempting to access through the localhost (or 127.0.0.1). However, I'm able to access the database via localhost through PHP and the MySQLQuery Browser and MySQL Aministrator.
If needed here's the entire method I'm using:
public Database() throws Exception { Class.forName("com.mysql.jdbc.Driver").newInstance(); try { conn = DriverManager.getConnection("jdbc:mysql://myWebsite.com:3306/schemaName?user=userX&password=passwordX"); // Next line does not work. // conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/schemaName?user=userX&password=passwordX"); } catch (SQLException ex) { displaySQLException(ex); // Seperate routine to display errors. } } Thanks for any help, Richard