just check your file name how u  saved it as.
----- Original Message -----
From: "Shahata, Ashraf" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 08, 2002 12:03 AM
Subject: urgent help please - error connecting to the db


> I have the following code, which is quite simple and used to connect to
the
> db, but I keep getting the error:
> Exception in thread "main" java.lang.NoClassDefFoundError: connect (wrong
> name:
> Connect)
>
> I'm trying to connect to mySQL using the mm.mysql-2.0.4-bin.jar jdbc
driver,
> which I placed in the CLASSPATH. Here's the code:
> import java.sql.*;
>
> public class Connect {
>   public static void main(String args[]) {
>     Connection con = null;
>     try {
>
>       Class.forName("org.gjt.mm.mysql.Driver");
>       System.out.println("JDBC driver loaded");
>       con = DriverManager.getConnection("jdbc:mysql://localhost/ash
> ?user=ashahata&password=ash123");
>       System.out.println("Database connection established");
>           } catch (ClassNotFoundException cnfe) {
>       System.out.println("ClassNotFoundException: Could not locate
driver");
>
>     } catch (SQLException cnfe) {
>       System.out.println("SQLException: "+cnfe);
>     } catch (Exception e) {
>       System.out.println("An unknown error occurred while connecting to
the
> database");
>     } finally {
>       try {
>         if ( con != null )
>         con.close();
>       } catch(SQLException sqle) {
>         System.out.println("Unable to close database connection.");
>       }
>     }
>   }
> }
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to