Try these:

    Class.forName("org.gjt.mm.mysql.Driver");

    con = DriverManager.getConnection
                      ("jdbc:mysql://localhost/Testing", <my username>, <my
pass>);

Make sure the jar file in the mm.mysql-2.0.11 directory is in your
classpath/
mm.mysql does NOT use the odbc driver.

> Subject: Java to MySQL connection
> Date: Wed, 20 Mar 2002 14:42:43 -0500
> From: "Chris Stewart" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
>
> I'm trying to make a connection from a java app to a MySQL database I've
> created on my local PC.  How can I tell the app where to look for the
> existing database?
>
> Code I'm working with:
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
> Connection con =
> DriverManager.getConnection("jdbc:odbc:Testing@localhost:3306", "< my
> username >", "< my pass >");
> System.out.println("Connection Made.");
>
> As you can tell from this, my database is named "Testing".  All I'm
> trying to do right now is get a connection.  Right now when I run this
> code I get "Error: java.sql.SQLException: [Microsoft][ODBC Driver
> Manager] Data source name not found and no default driver specified".
> I'm not sure I have the odbc driver setup correctly either.  I
> downloaded "mm.mysql-2.0.11" but I'm not really sure how to bring it
> into the mix as far as the driver goes.
>
> Thanks for any direction.
>
> Chris Stewart
> [EMAIL PROTECTED]




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to