RE: Java to MySQL connection
there is odbc support on linux, you can find a link the the myodbc drive for mysql on mysql.com -Original Message- From: Liyju Janardhan [mailto:[EMAIL PROTECTED]] Sent: 21 March 2002 03:30 To: Chris Stewart; [EMAIL PROTECTED] Subject: Re: Java to MySQL connection which Driver your using? which Operating system your using? If your using linux, as far as I know there is now odbc support. You have to downlaod mm.mysql driver. If your are using windows you will have to create a dsn name for the your selected driver. --- Chris Stewart <[EMAIL PROTECTED]> wrote: > 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 > __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards(r) http://movies.yahoo.com/ - 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 - 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
Re: Java to MySQL connection
which Driver your using? which Operating system your using? If your using linux, as far as I know there is now odbc support. You have to downlaod mm.mysql driver. If your are using windows you will have to create a dsn name for the your selected driver. --- Chris Stewart <[EMAIL PROTECTED]> wrote: > 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 > __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ - 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
Re: Java to MySQL connection
Try these: Class.forName("org.gjt.mm.mysql.Driver"); con = DriverManager.getConnection ("jdbc:mysql://localhost/Testing", , ); 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
Re: Java to MySQL connection
This is a servlet code example for jdbc using the mm driver. String DB_NAME = "database"; String DB_HOST = "localhost"; String DB_USER = "username"; String DB_PASS = password; String DB_DRIVER = "org.gjt.mm.mysql.Driver"; String DB_CONNECTION = "jdbc:mysql://" + DB_HOST + "/" + DB_NAME + "?user=" + DB_USER + "&password=" + DB_PASS; try { Class.forName(DB_DRIVER); conn = DriverManager.getConnection(DB_CONNECTION); out.println("JDBC Connection succeeded."); } catch (Exception e) { out.println(e.getMessage()); } Ken Chris Stewart wrote: > > 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 - 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