jeanpierre
Technical User
I have a problem loading the database driver for MySQL.
OS : Win XP (Home)
Database : MySQL
JDBC Driver : MM.MySQL
What I did to install the driver : I un-archived the distribution .jar archive,
you can install the driver in two ways-
1) When to Control Panel|Systems|Advance|Environment Variables and entered the path to the org subdirectory of the downloaded folder - C:\mm.mysql-2.0.11\org
2) To be doubly safe, I added mm.mysql-2.0.11-bin.jar folder to C:\j2SDK1.4.0\jre\lib\ext
Here is the code I used to establish a connection. The database is called "test":
import java.sql.*;
public class ConnecTion{
public static void main(String args[])
{
Connection connection;
try {
Class.forName("org.gjt.mm.mysql.Driver"
String url = "jdbc:mysql://localhost/test";
String username = "dillinger";
String password = "master";
connection = DriverManager.getConnection(url, username, password);
}
catch (ClassNotFoundException e) {
System.err.println("Could not load database driver!"
}
catch (SQLException e) {
System.err.println("Could not connect to the database!"
}
}
}
The errors message I receive is "Cannot load database driver!"
Are there any suggestions?
Thanks.
OS : Win XP (Home)
Database : MySQL
JDBC Driver : MM.MySQL
What I did to install the driver : I un-archived the distribution .jar archive,
you can install the driver in two ways-
1) When to Control Panel|Systems|Advance|Environment Variables and entered the path to the org subdirectory of the downloaded folder - C:\mm.mysql-2.0.11\org
2) To be doubly safe, I added mm.mysql-2.0.11-bin.jar folder to C:\j2SDK1.4.0\jre\lib\ext
Here is the code I used to establish a connection. The database is called "test":
import java.sql.*;
public class ConnecTion{
public static void main(String args[])
{
Connection connection;
try {
Class.forName("org.gjt.mm.mysql.Driver"
String url = "jdbc:mysql://localhost/test";
String username = "dillinger";
String password = "master";
connection = DriverManager.getConnection(url, username, password);
}
catch (ClassNotFoundException e) {
System.err.println("Could not load database driver!"
}
catch (SQLException e) {
System.err.println("Could not connect to the database!"
}
}
}
The errors message I receive is "Cannot load database driver!"
Are there any suggestions?
Thanks.