This week's book giveaway is in the
Agile and other Processes
forum.
We're giving away four copies of
The Mikado Method
and have Ola Ellnestam and Daniel Brolund on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
Problems connecting to MySQL.
Craig Snowbarger
Ranch Hand
Joined: Mar 07, 2001
Posts: 38
posted
May 09, 2001 12:11:00
0
I'm trying to connect to MySQL with the code below and I keep getting the error at the bottom. Any ideas?
Code:
try { String url = "jdbc:mysql://localhost/TestSetTracker"; Class.forName( "org.gjt.mm.mysql.Driver" ).newInstance(); dbconn = DriverManager.getConnection( url ); } catch ( ClassNotFoundException cnfex ) { cnfex.printStackTrace(); cnfex.toString(); } catch ( SQLException sqlex ) { sqlex.printStackTrace(); sqlex.toString(); } catch ( Exception excp ) { excp.printStackTrace(); }
Exception:
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:3306 connect,resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272) at java.security.AccessController.checkPermission(AccessController.java:399) at java.lang.SecurityManager.checkPermission(SecurityManager.java:545) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1044) at java.net.Socket.<init>(Socket.java:262) at java.net.Socket.<init>(Socket.java:100) at org.gjt.mm.mysql.MysqlIO.<init>(MysqlIO.java:114) at org.gjt.mm.mysql.Connection.<init>(Connection.java:229) at org.gjt.mm.mysql.Driver.connect(Driver.java:126) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at Login.makeConnection(Login.java:38) at Login.<init>(Login.java:24) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at sun.applet.AppletPanel.createApplet(AppletPanel.java:579) at sun.applet.AppletPanel.runLoader(AppletPanel.java:515) at sun.applet.AppletPanel.run(AppletPanel.java:293) at java.lang.Thread.run(Thread.java:484) java.sql.SQLException: Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.security.AccessControlException) at org.gjt.mm.mysql.Connection.<init>(Connection.java:239) at org.gjt.mm.mysql.Driver.connect(Driver.java:126) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at Login.makeConnection(Login.java:38) at Login.<init>(Login.java:24) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at sun.applet.AppletPanel.createApplet(AppletPanel.java:579) at sun.applet.AppletPanel.runLoader(AppletPanel.java:515) at sun.applet.AppletPanel.run(AppletPanel.java:293) at java.lang.Thread.run(Thread.java:484)
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
May 09, 2001 14:55:00
0
Don't you need a user id and password?
Associate Instructor - Hofstra University
Amazon Top 750 reviewer
-
Blog - Unresolved References
-
Book Review Blog
Stan Levine
Greenhorn
Joined: Jan 21, 2001
Posts: 22
posted
May 16, 2001 19:13:00
0
Craig, I recently had a similar problem which was solved. See my POST on May 15. Stan Levine
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Problems connecting to MySQL.
Similar Threads
MYSQL Connection error Plz help
mouseOver
A question about the Applet!
java.sql.SQLException: Communication link failure: null
Bad Handshake
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter