Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can not find driver?

 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you register the driver?
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should have a statement like: Class.forName(jdbcDriver);
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Open the jar files using WinZip.
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you get if you type:
SET CLASSPATH
at the DOS prompt?
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i just type "SET CLASSPATH",I got "syntax error"in dos prompt.Is the syntax wrong?
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does the classpath show if you type SET at the DOS prompt?
 
long sun
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic