List:MySQL and Java« Previous MessageNext Message »
From:Christian Mack Date:March 26 1999 12:12pm
Subject:Re: null pointer exception (mm jdbc)
View as plain text  
Eric Eldred wrote:
> 
> sorry I'm a real beginner here and have studied the docs,]
> books, and previous postings without success.
> 
> i am trying to use the mm jdbc driver with:
> v1.3 (1998-08-25) of Driver.java
> v9.13 (3.21.29a-gamma) of mysql for win95.
> jdk1.2 for win32.
> 
> mysql works fine by starting the mysqld
> and from the mysql console.  my TCP works fine
> and I can ping localhost or 192.168.1.1, my IP.
> 
> then i installed the Driver.class etc under
> d:\jdk1.2\org\gjt\mm\mysql\
> and wrote a simple java program to open the
> connection to my testdb:
> 
> ...
> Connection conn = null;
> Class.forName("org.gjt.mm.mysql.Driver").newInstance();
> Properties P = System.getProperties();
> P.put("jdbc.drivers", "org.gjt.mm.mysql.Driver");
> System.setProperties(P);
> conn =
> DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb");
> ...etc
> 
> when i try to run it it gives me no SQLException,
> but rather a null pointer exception when i try to
> close the connection, with a stack
> trace that points to
> Exception in thread "main" java.lang.ClassFormatError:
>  org/gjt/mm/mysql/Connection (Invalid start_pc/length in local var
> table)
> 
> (i think this refers to the Connection.class that mm
> supplies, and which is called by Driver, and
> which is labeled as not to be used by user.)
> 
> i tried adding null user and password fields to the
> getConnection string, and using the IP address and
> so on, as previously recommended, but it continues
> to give me the same error.  please, any suggestions?
> 
> may i suggest that all this could use some better
> documentation, with more specific examples that work,
> and some clear pointers on installation?

Hi Eric

You have to give a MySQL user name and a MySQL user password with getConnection(...).
The URL is _not_ sufficient!

Tschau
Christian

Thread
null pointer exception (mm jdbc)Eric Eldred26 Mar
  • Re: null pointer exception (mm jdbc)Christian Mack26 Mar