Hello,
I am trying to connect a java program to MySQL.
I have downloaded the following package:
mysql-connector-java-nnn , and installed it in my /usr/local/bin/mysql-connector-java-nnn/ directory. According to a number of posts, all that I really need from this is the mysql-connector-java.jar package.
I then run the following Java script to see if it is working;
Code:
import java.sql.*;
public class TestMysql
{
public static void main(String args[]) {
try {
/* Test loading driver */
String driver = "com.mysql.jdbc.Driver";
System.out.println( "\n=> loading driver:" );
Class.forName( driver ).newInstance();
System.out.println( "OK" );
/* Test the connection */
String url = "jdbc:mysql://localhost:3306/<dir>";
System.out.println( "\n=> connecting:" );
DriverManager.getConnection( url, "user", "password" );
System.out.println( "OK" );
}
catch( Exception x ) {
System.err.println( x );
}
}
}
and I get the following error:
Any help would be greatly appreciated