aspose file tools*
The moose likes JDBC and the fly likes JDBC and Pointbase Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC and Pointbase" Watch "JDBC and Pointbase" New topic
Author

JDBC and Pointbase

Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
I recently installed J2EE 1.4 and this has Pointbase 4.6.
I can see that it has three jars (for Drievr, I guess):
pbclient.jar
pbembedded.jar
pbtools.jar
Now I wrote a dumbest Java program to access one of it's table called EMP.
I can see that the URL of the database is:
jdbc :pointbase ev (as displayed as node in PointBase Console) and it's on port 9092.
Please see the program below:

I'm getting various errors. First of all, it's not recognizing Driver and then it's saying that database DEV doesn't exist.
Please tell me what Settings do I need to make in CLASSPATH, javac, java etc.
And how to successfully run it...
Thanks in advance..
Rajeev.
[ May 10, 2004: Message edited by: Jeanne Boyarsky ]
Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
Why is it converting colon into faces?

(edited to remove cursing)
[ May 10, 2004: Message edited by: Jeanne Boyarsky ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Rajeev,
You need to check the disable smilies checkbox at the bottom of the posting page. (I edited it for you to do that.) In the future, you can always go back and edit your own post to do the same thing if you realize it afterwards.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Rajeev,
Now on to your question:
The first thing you need to do is put all that code in one large try/catch block instead of a bunch of little ones. Otherwise, you run into a problem when an early thing fails. For example, if it can't find the driver, you don't want it trying to connect.
You need to double check that the driver is in your classpath. Are you using an IDE? Sometimes these things need to be set up in multiple places.
Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
Originally posted by Jeanne Boyarsky:
Rajeev,
Now on to your question:
The first thing you need to do is put all that code in one large try/catch block instead of a bunch of little ones. Otherwise, you run into a problem when an early thing fails. For example, if it can't find the driver, you don't want it trying to connect.
You need to double check that the driver is in your classpath. Are you using an IDE? Sometimes these things need to be set up in multiple places.

Thanks for the advise, I did following:
1. Changed the code to put a single try block.
2. Added pmembedded.jar in CLASSPATH. There are 2 more jars - pmclient.jar and pmtools.jar
3. Compiled source
4. When I tried to run it, it gave error that "No suitable driver".
What should I do now...
Thanks..
BTW, the code is
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Rajeev,
Sun has this error listed in their FAQ. It is probably a problem with your URL string.
Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
Originally posted by Jeanne Boyarsky:
Rajeev,
Sun has this error listed in their FAQ. It is probably a problem with your URL string.

It worked after I used pbembedded.jar instead of pbclient.jar.
I don't know why (may be the actual driver is inside this pbembedded.jar).
But is there a way to check whether a driver is in a particular jar?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Rajeev,
A jar file is the same format as a zip file. So you can unjar/unzip it and look to see if the class is in the file. If you have Winzip, the preview mode lets you see an alphabetical list of all the files without having to unzip it.
Rajeev Asthana
Ranch Hand

Joined: Oct 27, 2003
Posts: 43
Originally posted by Jeanne Boyarsky:
Rajeev,
A jar file is the same format as a zip file. So you can unjar/unzip it and look to see if the class is in the file. If you have Winzip, the preview mode lets you see an alphabetical list of all the files without having to unzip it.


Thanks Jeanne....I saw what you are saying..

I have a related question. Are URLs different for a standalone Java program and a Java program that is deployed in Application Server? How to find what URL to use? Also, can the same driver be used for different URLs?
[ May 13, 2004: Message edited by: Rajeev Asthana ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Rajeev,
No the URLs are not different. Some drivers have specific urls. For example, Oracle has a piece of the URL that specifies if you are using a thin driver.
 
jQuery in Action, 2nd edition
 
subject: JDBC and Pointbase