This week's book giveaway is in the Testing forum.
We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line!
See this thread for details.
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLException in connecting to mysql

mkoliop juiok
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I am trying to connect to mysql 4.1 through WSAD but I am getting the following errors:

java.sql.SQLException: Cannot load connection class because of underlying exception: 'java.lang.SecurityException: Prohibited package name: java.util'.
at com.mysql.jdbc.NonRegisteringDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at cdmanager.util.DbUtil.connectToDb(
at cdmanager.util.DbUtil.main(
Error connecting to database

My code is:
package cdmanager.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DbUtil {
static Connection connection;
static String driverName="";
static String dbUrl="jdbc:mysql://localhost/cdsample";

public DbUtil() {


public static java.sql.Connection connectToDb()



Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/cdsample?user=guest&password=guest");

catch(Exception e)

System.err.println("Connection name = " + dbUrl);
return connection;

public static void main(String[] args)
Connection c=connectToDb();
if (c==null)
System.out.println("Error connecting to database");
System.out.println("connected to database");


I am using mysql-connector-java-3.1.10(mysql-connector-java-3.1.10-bin.jar).

Is this a bug??

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic