File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Can not find driver? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can not find driver?" Watch "Can not find driver?" New topic
Author

Can not find driver?

long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18

I have two questions to confuse me,pls help:


1. I used book "CORE JAVA" to do the test following the steps,i put the pointbase in directory "c:\pointbase" where have subdirectory as "bin,classes,corejava,databases,docs,examples".In classes subdirectory ,there are three executable jar files like "pointbasemobile228r,pointbasetools228r,swingall",so i set the path as "set classpath=%classpath%;c:\poinbase\classes;".
But when i run the MakeDB program which is in the directory "c:\corejava\v2ch4\MakeDB",it gave me message under MS-DOS"
SQLException:
SQLState:08001
Message: No suitable driver
Vendor: 0
Press any key to continue . . . "
Every time i got the same error,i try many times to set the diffirent path .
2. I also don't know where i put the properties file,this file
is automatically put in the same folder with MakeDB program file.
Anybody can help me? Who study the same book can help me a lot.
Thanks!
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
jar files must be specifically named in the classpath.
So don't do:
set classpath=%classpath%;c:\poinbase\classes;
but rather
set classpath=%classpath%;c:\poinbase\classes\pointbasemobile228r.jar;
c:\poinbase\classes\pointbasetools228r.jar;c:\poinbase\classes\swingall.jar
[This message has been edited by Thomas Paul (edited February 28, 2001).]


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
Hi,Thomas:
Thank you for your help!
I set the classpath like you gave me above,but i got the same error,why?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Did you register the driver?
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
In my MakeDB program,the connection object is:
public static Connection getConnection()
throws SQLException, IOException
{ Properties props = new Properties();
String fileName = "MakeDB.properties";
FileInputStream in = new FileInputStream(fileName);
props.load(in);

// I don't know if it means register?
String drivers = props.getProperty("jdbc.drivers");
if (drivers != null)
System.setProperty("jdbc.drivers", drivers);
String url = props.getProperty("jdbc.url");
String username = props.getProperty("jdbc.username");
String password = props.getProperty("jdbc.password");
return
DriverManager.getConnection(url, username, password);
}
Please clear me if the driver is registered or not?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
You should have a statement like: Class.forName(jdbcDriver);
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
I add the statement :
Class.forName("com.pointbase.jdbc.jdbcDriver")
I got :
Exception:java.lang.ClassNotFoundException:
com.pointbase.jdbc.jdbcDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
............
What can i do now? This problem spent me about a week,i am almost disapointed.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
If it is telling you that the class is not found then that means it did not find the class. Is the class on your classpath? If it is in a jar or zip file is that jar or zip file specifically named in your classpath?
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
Thomas:
Yes,i've already set classpath in the Autoexe.bat like you gave me above :
"set classpath=%classpath%; c:\pointbase\classes\pointbasemobile228r.jar;c:\pointbase\classes\pointbasetools228r.jar;c:\pointbase\classes\swingall.jar "
If it has another problem?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Did you check to make sure that com.pointbase.jdbc.jdbcDriver is in one of those jar files? I wonder if jdbcDriver should be JdbcDriver since most classes start with a capital letter.
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
I try to use JdbcDriver instead of jdbcDriver,i got the same error,so i think it's not the problem. But I don't know how to make sure that com.pointbase.jdbc.jdbcDriver is in one of the jar file,i just know that the pointbase driver should be in one of three jar files below:
"c:\pointbase\classes\pointbasemobile228r.jar;
c:\pointbase\classes\pointbasetools228r.jar;
c:\pointbase\classes\swingall.jar"
Can you show me? Thank you for so many help to me .
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Open the jar files using WinZip.
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
Dear Thomas:
I opened jar file and found jdbbcDriver is in there,i try some different name to put in the program,but the result is the
same error,what is the hell?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
And was it in the com.pointbase.jdbc package?
If you have the classpath set correctly, and you have everything spelled correctly...
is the classpath set correctly when you type "set" at the dos prompt?
After this I am at a total loss.
Joe Paolangeli
Ranch Hand

Joined: Apr 05, 2000
Posts: 73
As Thomas has stated the package and class name needs to be spelled correctly and is also case sensitive. Try opening up the jar file again and write down the exact package and class name including upper and lower case letters.
Good Luck,
Joe
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
Sorry for so late come in!
I checked jar file again and no error with the character which i input.Because i am new learner,maybe have some other problems that i never notice .Do i need to set the DSN,i think the pointbase DB is pure java driver,so i don't need to set the DSN.Is right,thanks for all of you .
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
What do you get if you type:
SET CLASSPATH
at the DOS prompt?
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
When i just type "SET CLASSPATH",I got "syntax error"in dos prompt.Is the syntax wrong?
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
What does the classpath show if you type SET at the DOS prompt?
long sun
Greenhorn

Joined: Feb 24, 2001
Posts: 18
Thomas:
I got :
CLASSPATH=c:\pointbase\classes\pointbasemobile228r.jar;
c:\pointbase\classes\pointbasetools228r.jar;
c:\pointbase\classes\swinggall.jar;
And i see the com.pointbase.jdbc.jdbcDriver in the first jar file.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
I got this from the PointBase website:
PointBase Mobile Edition
pbmobilennGA.jar
Approx. File size: 981kb
Contains the embedded Mobile Edition version of the PointBase ORDBMS. This version is embedded in the application that invokes it, running in the same JVM as that application. It is a single connection database which allows multithreaded access to a database through a single connection object. The Mobile driver is com.pointbase.jdbc.jdbcUniversalDriver and the url format is jdbc:pointbase:[,new]

http://www.pointbase.com/devcentral/tip/PBT05.html
[This message has been edited by Thomas Paul (edited March 04, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not find driver?
 
Similar Threads
webwork beginners filepath confusion
importing multiple classes from a package
NoClassDefFoundError re JDBC
Assignment 1a
JDBC Driver Installed ???