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
Ciaran Coyne <cco...@and.ie> schrieb in im Newsbeitrag:
39BE075E...@and.ie...
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.
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
>--- 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 *
*******************************************************************************
> 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...
> 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.
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.
java ort.gjt.mm.mysql.Buffer
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...
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