Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

jdbc:mysql , but AccessControlException

  Asked By: Phil    Date: May 16    Category: Java    Views: 1152
  

I am trying to connect to MySql database but I got below exception:

java.sql.SQLException: Unable to connect to any hosts due to
exception: java.security.AccessControlException: access denied
(java.net.SocketPermission localhost resolve)

and this is a piec of my code:
Class.forName("org.gjt.mm.mysql.Driver");

con = DriverManager.getConnection
("jdbc:mysql://localhost:3306/db","test","102030" );

I have tested this code in my station and it is Ok, I got this
exception when I tried to host it in a valid IP address.

I apprecite your comments.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Adalric Fischer     Answered On: May 16

You have to set the permissions for the database  in the "user" and "db"
table, which is present in the mysql  database.

 
Didn't find what you were looking for? Find more on jdbc:mysql , but AccessControlException Or get search suggestion and latest updates.