List:MySQL ODBC« Previous MessageNext Message »
From:Christian Mack Date:September 8 1999 7:34pm
Subject:Re: Newbie questions
View as plain text  
Tom wrote:
> 
> Hi everyone.  I'm still having a hard time figuring out this whole MySQL JDBC-ODBC
> thing.  I know how ODBC works on a Windows platform, so the overall concept of ODBC is
> clear to me.
> 
> Here's the problem: how do I "register" a DNS using either the
> twz1.jdbc.mysql.jdbcMysqlDriver or the gweMysqlDriver?  I've installed twz1 (per
> installation instructions) to a subdirectory that's in the classpath..still I get the
> message "driver not found".  How do I make this driver available to a program?  In
> Windows, it's a matter of using the ODBC manager to laod the driver in the
> registry...what's the equivalent function in a Linux environment?
> 
> Sorry for the incoherence.  Simple instructions would be much appreciated!

Hi Tom

You are a little confused here.
First: 
JDBC is not ODBC!!!
You only get an JDBC-ODBC-bridge with the SUN VM.
To use this bridge, you have to use "jdbc:odbc:// ..." instead of "jdbc:z1MySQL:// ..."
(see Fourth).
This is used like any JDBC driver.
This means, that you can't use DSN's.

Second:
Please forget gwe driver it is over one year old and not maintained anymore (= read awfull
buggy).

Third:
In order to use an JDBC driver, you have to include its classes into the CLASSPATH and you
have to load him into the JDBC driver manager (= class java.sql.DriverManager).

The loading thing is done by:
    Class.forName("twz1.jdbc.mysql.jdbcMysqlDriver").newInstance();

This should only happen once in your program.

Fourth:
You actually use the JDBC by getting a Connection via the DriverManager class like this:
    String uRL = "jdbc:z1MySQL://your.mysql.host.com:3306/db_you_wish";
    String userName = "root";
    String userPasswd = "Secret";
    try {
        Connection con = DriverManager.getConnection( uRL, userName, userPasswd );
    }
    catch (SQLException sqlE1) {
        // Unsuccessful attempt to connect to mysql on your.mysql.host.com
        sqlE1.printStackTrace();
    }

Fifth:
You shoud look at the java.sql package documentation and the examples that come with the
twz driver.

Tschau
Christian

PS: Sorry for the late answer, I was really busy.

Thread
Newbie questionsTom24 Aug
  • Re: Newbie questionsChristian Mack8 Sep