Posted by: gauri18
Date: January 31, 2005 05:21AM


I am just starting with Connector/J on linux. I have mysql account ( not root user) and I am trying to test the mysql and Connector /J with a simple program:

mport 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://my-ip/test";

System.out.println( "\n=> connecting:" );
DriverManager.getConnection( url, "", "" );
System.out.println( "OK" );
catch( Exception x ) {
System.err.println( x );
However I keep getting a the error:

I did some seraching on the internet and tried out all possible solutions:
1.copied the mysql-connector-java-3.0.16-ga-bin.jar file to JAVA_HOME/jre-lib/ext directory.
2.set the classpath to reflect the dir /JAVA_HOME/jre/lib/ext/mysq-....bin.jar
3.PLaced the files (program file and .jar file) in same dir

But i keep getting the error. I am really new to this ..can someone pls help me!!

Options: ReplyQuote

Written By
January 31, 2005 05:21AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.