Jump to content

[SOLVED] Mysql Connection with JAVA!


rameshfaj

Recommended Posts

Hi everyone,I am using windowsXp and want to connect the JAVA programs to use the mysql connection.

I have also downloaded the connector

mysql-connector-java-3.1.14-bin-g.jar

and specified its path in the Administrator/Uservariable(Environment variable) as the CLASSPATH.

But when the java files are run,it generates the error:NoSuitableDriver found Exception.

 

Am i wrong with the classpath or what?

Any kind of help are heartly accepted.

 

Link to comment
Share on other sites

I have modified only the Administrator/user variable.Though i do restarting also but the same problem exists.

The error generated is:

Exception in thread "main" java.lang.NoClassDefFoundError:org/aspectj/lang/Signature

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown source)

at LoadDriver.main(LoadDriver.java:10)

Link to comment
Share on other sites

I have modified only the Administrator/user variable.Though i do restarting also but the same problem exists.

The error generated is:

Exception in thread "main" java.lang.NoClassDefFoundError:org/aspectj/lang/Signature

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown source)

at LoadDriver.main(LoadDriver.java:10)

 

 

The code was:

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.SQLException;

 

public class LoadDriver {

public static void main(String[] args) {

try {

// The newInstance() call is a work around for some

// broken Java implementations

Class.forName("com.mysql.jdbc.Driver").newInstance();

} catch (Exception ex) {

 

System.out.println("Error"+ex);

// handle the error

 

}

}

}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.