List:General Discussion« Previous MessageNext Message »
From:Christian Mack Date:June 10 1999 6:35pm
Subject:Re: jdbc question
View as plain text  
Steve Ruby wrote:
> 
> Anybody have experience with the jdbc driver org.gjt.mm
> I know I posted on this earlier but i have my question
> narrorwed down
> 
> If I run these lines as is I get a NullPointerException when
> I try to create a Statement
> 
> Class.forName("org.gjt.mm.mysql.Driver");
> con =
> DriverManager.getConnection("jdbc:mysql://semops.svm.com:3306/AMR?user=root&password=");
> //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> //con = DriverManager.getConnection("jdbc:odbc:AMR2","admin","");
> 
> If I switch the comments so I am running on the jdbc-odbc bridge
> then it works fine (the rest of the app being the same) I read the
> docs on the org.gjt.mm driver and I think I am using it correctly,
> I have tried several variations on the connection string with nosuccess
> 
> the ODBC Datasource AMR2 is just a MyODBC pointer to the
> AMR database, both work fine in other context I've used them
> in, I just can't get jdbc to work, I've also tried the twz1
> driver with similar results
> 
> I am using org.gjt.mm jdbc driver version 1.2a
> 
> Suggestions?
> 
> thanks
> Steve

Hi Steve

There is a known bug (especially in applets/servlets).
Due to a race condition sometimes the JDBC diver doesn't register itself, if you just use
Class.forName(...).
Because of this use:
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
or:
DriverManager.registerDriver( new org.gjt.mm.mysql.Driver() );

Tschau
Christian

Thread
jdbc questionSteve Ruby10 Jun
  • Re: jdbc questionChristian Mack10 Jun
  • Re: jdbc questionBenjamin Grosman11 Jun