Please forgive the simplicity of the question, but I'm having trouble reading between the lines regarding the JDBC interface. I have the following simple code, which load the bridge driver, and then attempts to connect to the driver. The system can't make the connection. My question is the address section of the url. Where would it be looking for a database "my-dsn", and if I have mySql located in the "C:" drive, what would the syntax appear like?
Thanks for your help Mike Bitzko public static void initialize() { String query = "SELECT * FROM emp"; String url = "jdbc:odbc:my-dsn"; try { // Load the jdbc-odbc bridge driver Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println(".. Loading of the system driver completed" ); DriverManager.setLogStream(System.out); // Attempt to connect to a driver. Each one // of the registered drivers will be loaded until // one is found that can process this URL System.out.println(".. Attempt to connect to a driver" ); Connection con = DriverManager.getConnection (url, "my-user", "my-passwd"); System.out.println(".. Attempt to connect is successful" ); checkForWarning (con.getWarnings ()); ======= \jdk1.3.1_01\bin\javaw -classpath "D:\IntroitSys\untitled1\classes;E:\JBuilder4\lib\jbcl.jar;E:\JBuilder4\lib\dx.jar;E:\JBuilder4\lib\beandt.jar;D:\jdk1.3.1_01\demo\jfc\Java2D\Java2Demo.jar;D:\jdk1.3.1_01\jre\lib\i18n.jar;D:\jdk1.3.1_01\jre\lib\jaws.jar;D:\jdk1.3.1_01\jre\lib\rt.jar;D:\jdk1.3.1_01\jre\lib\sunrsasign.jar;D:\jdk1.3.1_01\lib\dt.jar;D:\jdk1.3.1_01\lib\htmlconverter.jar;D:\jdk1.3.1_01\lib\tools.jar" untitled1.Application1 .. Loading of the system driver completed .. Attempt to connect to a driver DriverManager.getConnection("jdbc:odbc:my-dsn") trying driver[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver@4a8cd1] *Driver.connect (jdbc:odbc:my-dsn) JDBC to ODBC Bridge: Checking security No SecurityManager present, assuming trusted application/applet JDBC to ODBC Bridge 2.0001 Current Date/Time: Thu Nov 08 17:46:05 PST 2001 Loading JdbcOdbc library Allocating Environment handle (SQLAllocEnv) hEnv=166007376 Allocating Connection handle (SQLAllocConnect) hDbc=166007544 Connecting (SQLDriverConnect), hDbc=166007544, szConnStrIn=DSN=my-dsn;UID=my-user;PWD=my-passwd RETCODE = -1 ERROR - Generating SQLException... Closing connection (SQLFreeConnect), hDbc=166007544 Closing environment (SQLFreeEnv), hEnv=166007376 getConnection failed: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified *** SQLException caught *** SQLState: IM002 Message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Vendor: --------------------------------------------------------------------- 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