Forums Register Login

can't find jdbc driver

+Pie Number of slices to send: Send
My application can't find jdbc driver. My app is located
c:\windows\database and driver is located
c:\windows\database\msql. I am importing the msql directory.
My app comes up with about 67 errors. What am I doing wrong?
+Pie Number of slices to send: Send
Is the driver in your classpath?
------------------
Moderator of the JDBC Forum
+Pie Number of slices to send: Send
Yes, my MsqlDriver() is in the class path. But for some reason my app isn't finding the driver when I try to create an instance using new MsqlDriver();.
+Pie Number of slices to send: Send
How is it in your classpath?
If it's in a jar file then the jar file must be in the classpath. If it's a regular class then everything up to but not including the package must be included in the classpath. Example:
Class is in: /myjava/lib/com/msql/MsqlDriver
MsqlDriver is in the package com.msql
the classpath must have /myjava/lib in it. Not /myjava/lib/com/msql.
It seems that the driver is probably not in the correct directory since drivers are almost always part of a package and you don't appear to have it in the package structured directories.
+Pie Number of slices to send: Send
This is an example of how you can create a connection to a MySQL database using the mmsql JDBC driver:

This example was shamelessly ripped off from Mark Matthews' mySQL documentation. I included it because you mentioned this:


...when I try to create an instance using new MsqlDriver();.


I have never created an instance of a JDBC driver using the "new" keyword, and I wondered if this might be your problem.
[This message has been edited by Bodie Minster (edited April 19, 2001).]
+Pie Number of slices to send: Send
SET CLASSPATH=.;C:\PROGRA~1\JMF21~1.1_B\LIB\SOUND.JAR;
C:\PROGRA~1\JMF21~1.1_B\LIB\JMF.JAR;
C:\JDK1.3\LIB;
Sample Code:
Class.forName( "com.msql.MsqlDriver");
Using:
Class.forName( "com.msql.MsqlDr~1" );
still complains at run time but not as much. Which is to say it can't find the driver.
Driver is located this directory C:\JDK1.3\LIB\com\msql
This looks good to me. What do you think?
+Pie Number of slices to send: Send
My next step would be to open the JAR and look for the class by hand. If you can locate it, try extracting it and using it from outside the JAR. If you can't locate a .CLASS file in the JAR with the name MsqlDriver.class then that is the reason your code is failing. I don't think you will be able to reference a class file using the ~ notation that windows uses to compress long filenames. That notation makes the compiler angry. You will have to use the full class name.
Hang a left on main. Then read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1366 times.
Similar Threads
java.sql.Timestamp
JET odbc datasource slowing down
No suitable driver using msql
mysql JDBC driver
mSQL, tinySQLdriver, & JDBC-ODBC bridge
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:26:40.