Im trying to connect to my mySQL database hosted on elitehost.co.za.
I'm new at this so I do apologise in advance if this is obvious or I don't provide all the information needed (I swap same names with example names).
URL: pcassemble.co.za
Database: X
User: jim
Password: pwd
Added my ip to the remote access host allowed ips. The error message I am getting is:
I think the problem is the url in the string, but I have no idea what else it could be:
String url = "jdbc:mysql://pcassemble.co.za:3306/X";
I'm new at this so I do apologise in advance if this is obvious or I don't provide all the information needed (I swap same names with example names).
URL: pcassemble.co.za
Database: X
User: jim
Password: pwd
try{
String url = "jdbc:mysql://pcassemble.co.za:3306/X";
Class.forName ("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection (url,"jim","pwd");
System.out.println ("Database connection established");
}
catch (Exception e)
{
e.printStackTrace();
}
Added my ip to the remote access host allowed ips. The error message I am getting is:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user 'jim'@'196.215.89.%' to database 'X'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:935)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4101)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1300)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2337)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2370)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at test.main(test.java:17)
I think the problem is the url in the string, but I have no idea what else it could be:
String url = "jdbc:mysql://pcassemble.co.za:3306/X";
Last edited: