MySQL Forums
Forum List  »  Microsoft SQL Server

Re: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Posted by: Doni Osmon
Date: January 04, 2007 08:56PM

Thamodara Jegan Wrote:
-------------------------------------------------------
> I have the following error when i try to run Java
> file which has connections for MYSQL.
> java.lang.ClassNotFoundException:
> com.mysql.jdbc.Driver
> My program coding is
>
> import java.sql.*;
> public class newdata
> {
> static Connection cn;
> static Statement smt;
> static ResultSet rs;
> public static void main(String arg[])
> {
> try
> {
>
> String userName="root";
> String password="callno11";
> String url="jdbc:mysql://localhost/test";
> Class.forName
> ("com.mysql.jdbc.Driver").newInstance ();
> cn =
> DriverManager.getConnection(url,userName,password)
> ;
> smt = cn.createStatement();
> rs = smt.executeQuery("select * from
> stud");
> while(rs.next())
> System.out.println(rs.getString(1));
> }
> catch(Exception e){System.out.println(e);}
>
> }
> }
>
>
>
> I have set the path for mysl-connector.jar file
> could anyone help me to solve this issue?
> -Jegan

Options: ReplyQuote


Subject
Written By
Posted
Re: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
January 04, 2007 08:56PM


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.