Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

com.mysql.jdbc.Driver Exception

843859Nov 12 2005 — edited Nov 13 2005
Well, I'm somewhat new to java and I'm trying to work with a MySQL database. Anyway, I've downloaded the mysql-connector-java-3.1.11-bin.jar file and put it in C:\

I've compiled the following code example from the MySQL Connector/J documentatoin with the use of javac.exe and everything compiles fine:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class test
{
public static void main(String[] args)
{
try
{

Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception ex)
{
System.out.println(ex.getMessage()); // handle the error
}
}
}

Then I run it with:
java.exe -classpath C:\ test and I receive the exception message:
com.mysql.jdbc.Driver

I have looked around on the web for but can't seem to find a solution (even though this seems to be a common problem). Wondering if anyone can help me? Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 11 2005
Added on Nov 12 2005
5 comments
825 views