MySQL Connector/J Documentation :: 2.2.1 Setting the CLASSPATH (For Standalone Use)
Posted by: rehan_on_a_mission
Date: February 27, 2005 09:52AM

HELP ME PLEASE!!

Im a newbie and have been trying to connect to mysql using jbuilder. Heres my code:

private static final String URL =
"jdbc:mysql://localhost";
private static final String USERID = "root";
private static final String PASSWORD = "password";
private Connection connection;

public databaseManager() throws SQLException
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception E)
{
System.err.println("Unable to load driver.");
E.printStackTrace();
}

System.out.println("Connecting to database...");
connection = DriverManager.getConnection(URL, USERID, PASSWORD);
System.out.println("...connection established.");
}


Im getting java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

So there is a problem with my connector.

I connected using the following info but found it really confusing and not worded very well.
http://dev.mysql.com/doc/connector/j/en/cj-setting-classpath.html

Im not sure if ive done this bit right. Please could someone tell me how to do this.

Also is the URL and username at the top ok, im not sure how this is formatted either.

Thanks in advance

Options: ReplyQuote


Subject
Written By
Posted
MySQL Connector/J Documentation :: 2.2.1 Setting the CLASSPATH (For Standalone Use)
February 27, 2005 09:52AM


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.