Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mm.mysql driver..

2 views
Skip to first unread message

Ciaran Coyne

unread,
Sep 12, 2000, 6:37:18 AM9/12/00
to
Hi

I'm having trouble with the mm.mysql driver on solaris. Suggestions
gratefully recieved.. Here's a fairly basic program to load the driver
and test it which is dying as follows:

grenada:/opt/tomcat/build/tomcat/examples/WEB-INF/classes>java
LoadDriver
Here we go...

Unable to load driver.
java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.<init>(Throwable.java:94)
at java.lang.Exception.<init>(Exception.java:42)
at
java.lang.ClassNotFoundException.<init>(ClassNotFoundException.java:69)
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:191)
at java.lang.ClassLoader.loadClass(Compiled Code)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:275)
at java.lang.ClassLoader.loadClass(ClassLoader.java:238)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:125)
at LoadDriver.main(Compiled Code)
SQLException: No suitable driver
SQLState: 08001
ErrorCode: 0
grenada:/opt/tomcat/build/tomcat/examples/WEB-INF/classes>

$CLASSPATH looks like:

/export/projects/flight/java/jsdk2.1:/export/projects/flight/java/Solaris_JDK_1.2.1_04:/opt/tomcat/build/tomcat/classes/mm.mysql-2.0.2-src.jar:./

Source code to LoadDriver.java:

import java.io.*;
import java.sql.*;

public class LoadDriver {

public static void main(String args []) {

System.out.println("Here we go...\n");

try {
// Load and register the MySQL Driver
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
}
catch (Exception E) {
System.err.println("Unable to load driver.");
E.printStackTrace();
}

try {
// Make the connection...
Connection Conn = DriverManager.getConnection(
"jdbc:mysql://jamaica/flight?user=ccoyne"
);

Statement Stmt = Conn.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT Air_Des, Flight_Num
from IFS limit 10");
while (RS.next()) {
System.out.println(RS.getString(1));
}

RS.close();
Stmt.close();
Conn.close();

}
catch (SQLException E) {
System.out.println("SQLException: " + E.getMessage());
System.out.println("SQLState: " + E.getSQLState());
System.out.println("ErrorCode: " + E.getErrorCode());
}
}
}


Thanks,
Ciaran.

Paul Czerwionka

unread,
Sep 12, 2000, 9:35:58 AM9/12/00
to
hi,
erm not too familiar with that but does the mm.mysql-2.0.2-src.jar include
the *.class files or only the *.java files? if thats the case u hav to
compile the mysqldriver first then create a jar file and include it in your
classpath....

paul czerwionka

Ciaran Coyne <cco...@and.ie> schrieb in im Newsbeitrag:
39BE075E...@and.ie...

Ciaran Coyne

unread,
Sep 12, 2000, 10:46:40 AM9/12/00
to
Paul Czerwionka wrote:
>
> hi,
> erm not too familiar with that but does the mm.mysql-2.0.2-src.jar include
> the *.class files or only the *.java files? if thats the case u hav to
> compile the mysqldriver first then create a jar file and include it in your
> classpath....
>
> paul czerwionka

It's got both:

jamaica:/>jar tf ../../../classes/mm.mysql-2.0.2-src.jar
mm.mysql-2.0.2/org/
mm.mysql-2.0.2/org/gjt/
mm.mysql-2.0.2/org/gjt/mm/
mm.mysql-2.0.2/org/gjt/mm/mysql/
mm.mysql-2.0.2/org/gjt/mm/mysql/Buffer.class
mm.mysql-2.0.2/org/gjt/mm/mysql/Buffer.java
mm.mysql-2.0.2/org/gjt/mm/mysql/Connection.class
mm.mysql-2.0.2/org/gjt/mm/mysql/Connection.java
mm.mysql-2.0.2/org/gjt/mm/mysql/DatabaseMetaData.class
mm.mysql-2.0.2/org/gjt/mm/mysql/DatabaseMetaData.java
mm.mysql-2.0.2/org/gjt/mm/mysql/Debug.class
mm.mysql-2.0.2/org/gjt/mm/mysql/Debug.java
mm.mysql-2.0.2/org/gjt/mm/mysql/Driver.class
mm.mysql-2.0.2/org/gjt/mm/mysql/Driver.java
mm.mysql-2.0.2/org/gjt/mm/mysql/EscapeProcessor.class
mm.mysql-2.0.2/org/gjt/mm/mysql/EscapeProcessor.java

etc..

Ciaran.

Kenny A. Chaffin

unread,
Sep 12, 2000, 10:05:55 PM9/12/00
to
In article <39BE41D0...@and.ie>, cco...@and.ie says...

Have you got it in your classpath? Not just the directory, but the actual
jar file? I just used this on two different linux machines (not the
src/class jar, but the straight binary jar

Is the jar file in the right directory?

try just running one of the classes directly using java to see if it
finds it or gives errors

i.e.

java mm.mysql-2.0.2/org/gjt/mm/mysql/Buffer.class


Hope this helps,
KAC
--
KAC Website Design
Custom Programming (java,Dynamo...), Web Design/Graphics
ke...@kacweb.com - http://www.kacweb.com

Jerry McBride

unread,
Sep 13, 2000, 3:00:00 AM9/13/00
to
In article <39BE075E...@and.ie>, Ciaran Coyne <cco...@and.ie> wrote:
>Hi
>
>I'm having trouble with the mm.mysql driver on solaris. Suggestions
>gratefully recieved.. Here's a fairly basic program to load the driver
>and test it which is dying as follows:
>
>grenada:/opt/tomcat/build/tomcat/examples/WEB-INF/classes>java
>LoadDriver
>Here we go...
>

>--- snip ---<

Your setup looks correct, so try this. Uncompress the jar file then re-compress
it using your solaris java tools and try your java file again. My reason for
suggesting this is that I've run across a few apps that don't like the way that
IBM compresses their jdk classes.zip file. Uncompressing the classes.zip and
then re-conmpressing allows these apps. to run correctly. Maybe true on your
solaris.

One other suggestion, you don't HAVE to use a jar file. Those classes in the
jar can be run after the jar is uncompressed (while preserving the directory
tree layout within) and they run just fine. Have a try with that if the above
does not help.

--
*******************************************************************************
> Pro is to con as progress is to Congress. <
*******************************************************************************
> 1:05am up 1 days, 3:52:56, load: 23 processes, 84 threads. <
*******************************************************************************
* NetRexx - The onramp to the Internet - http://www2.hursley.ibm.com/netrexx *
*******************************************************************************
* ICQ# 76727806 *
*******************************************************************************
* Registered Linux User Number 185956 *
*******************************************************************************

Paul Czerwionka

unread,
Sep 13, 2000, 4:10:38 AM9/13/00
to
erm...
now i am a bit confused...

> mm.mysql-2.0.2/org/gjt/mm/mysql/Driver.class

is the path "mm.mysql-2.0.2" included in the jar archive?
it should look like "org/gjt/mm/mysql/Driver.class"

paul czerwionka

Ciaran Coyne <cco...@and.ie> schrieb in im Newsbeitrag:

39BE41D0...@and.ie...

Ciaran Coyne

unread,
Sep 13, 2000, 5:32:45 AM9/13/00
to
> > jamaica:/>jar tf ../../../classes/mm.mysql-2.0.2-src.jar
> > mm.mysql-2.0.2/org/
> > mm.mysql-2.0.2/org/gjt/
> > mm.mysql-2.0.2/org/gjt/mm/
> > mm.mysql-2.0.2/org/gjt/mm/mysql/

> Have you got it in your classpath? Not just the directory, but the actual


> jar file? I just used this on two different linux machines (not the

Yes, it's in my CLASSPATH:

jamaica:/opt/tomcat/build/tomcat/examples/WEB-INF/classes>echo
$CLASSPATH
/export/projects/flight/java/jsdk2.1:/export/projects/flight/java/Solaris_JDK_1.2.1_04:/opt/tomcat/build/tomcat/classes/mm.mysql-2.0.2-src.jar:.:/opt/tomcat/build/tomcat/classes

> src/class jar, but the straight binary jar

Where did you get the straight binary jar? Seems maybe the src/class
jar might be the cause of my troubles...

> Is the jar file in the right directory?

It's in the CLASSPATH, is that enough?

>
> try just running one of the classes directly using java to see if it
> finds it or gives errors
>
> i.e.
>
> java mm.mysql-2.0.2/org/gjt/mm/mysql/Buffer.class

Tried the above and got:
jamaica:/> java mm.mysql-2.0.2/org/gjt/mm/mysql/Buffer.class
Exception in thread "main" java.lang.NoClassDefFoundError:
mm/mysql-2/0/2/org/gjt/mm/mysql/Buffer/class

and then tried:

jamaica:/> java org/gjt/mm/mysql/Buffer
Exception in thread "main" java.lang.NoClassDefFoundError:
org/gjt/mm/mysql/Buffer

Thanks for the suggestions..
Ciaran.

Ciaran Coyne

unread,
Sep 13, 2000, 5:38:44 AM9/13/00
to
Paul Czerwionka wrote:
>
> erm...
> now i am a bit confused...
>
> > mm.mysql-2.0.2/org/gjt/mm/mysql/Driver.class
>
> is the path "mm.mysql-2.0.2" included in the jar archive?
> it should look like "org/gjt/mm/mysql/Driver.class"

Well, that's what's listed when I "jar tf mm.mysql-2.0.2-src.jar" to
check what's in the jar. Maybe there's something wrong with my setup
here?

Tried this change:
Class.forName("mm.mysql-2.0.2/org.gjt.mm.mysql.Driver").newInstance();

and got this output (briefer than before - feels like progress :)
jamaica:/> java LoadDriver
Here we go...

Unable to load driver.
java.lang.ClassNotFoundException: mm.mysql-2.0.2/org.gjt.mm.mysql.Driver


at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:125)
at LoadDriver.main(Compiled Code)
SQLException: No suitable driver
SQLState: 08001
ErrorCode: 0

Maybe something wrong with the jar file I've got?

Thanks for the ideas,
Ciaran.

Kenny A. Chaffin

unread,
Sep 13, 2000, 6:16:31 AM9/13/00
to
In article <39BF49BD...@and.ie>, cco...@and.ie says...
oops, that shoulda been

java ort.gjt.mm.mysql.Buffer

Paul Czerwionka

unread,
Sep 13, 2000, 8:12:40 AM9/13/00
to
hm,
dunno about that one... maybe u should really get the mysql driver from
http://www.worldserver.com/mm.mysql/

i've got the mm.mysql-2.0.2-bin.jar working with
Class.forName( "org.gjt.mm.mysql.Driver" ).newInstance();
using the jdk 1.2.2

paul czerwionka

Ciaran Coyne <cco...@and.ie> schrieb in im Newsbeitrag:

39BF4B24...@and.ie...

Ciaran Coyne

unread,
Sep 13, 2000, 10:21:39 AM9/13/00
to
Paul Czerwionka wrote:
>
> hm,
> dunno about that one... maybe u should really get the mysql driver from
> http://www.worldserver.com/mm.mysql/

Will look for the bin version. THat's where I got my current driver
from (didn't notice different versions there at the time).

Thanks,
Ciaran.

Ciaran Coyne

unread,
Sep 14, 2000, 3:00:00 AM9/14/00
to
Thanks to everyone for the suggestions - I downloaded the
mm.mysql-2.0.2-bin.jar file (as opposed to mm.mysql-2.0.2-src.jar) and
put that in my CLASSPATH and everything's working fine..

Ciaran

0 new messages