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
https://forums.phpfreaks.com/topic/58167-solved-mysql-connection-with-java/
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)

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

 

}

}

}

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.