• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

A simple Java question regarding JDBC...

Status
Not open for further replies.

Vlad

Member
Ok, so I've got this program to do for a Java class which involves using JDBC stuff to connect to a local database running off Pointbase and allow for different operations on the database through a GUI.

I know exactly how I'm going to go about doing all the operations and stuff, but for the life of me I can't get the program to actually connect to the database. It keeps throwing a ClassNotFoundException at this line:

Class.forName(driver);

Where driver = "com.pointbase.jdbc.jdbcUniversalDriver"

Now, I know that that driver is valid, as I copy/pasted it from the GUI Pointbase thing that comes with J2EE, but for some reason my Java program is being fickle and not connecting correctly.

Any ideas?
 

TheOMan

Tagged as I see fit
Vlad said:
Ok, so I've got this program to do for a Java class which involves using JDBC stuff to connect to a local database running off Pointbase and allow for different operations on the database through a GUI.

I know exactly how I'm going to go about doing all the operations and stuff, but for the life of me I can't get the program to actually connect to the database. It keeps throwing a ClassNotFoundException at this line:

Class.forName(driver);

Where driver = "com.pointbase.jdbc.jdbcUniversalDriver"

Now, I know that that driver is valid, as I copy/pasted it from the GUI Pointbase thing that comes with J2EE, but for some reason my Java program is being fickle and not connecting correctly.

Any ideas?

The only advice I can offer based on your description is to check your classpath and ensure that the jar file that houses the driver class is on it.
 

Vlad

Member
TheOMan said:
The only advice I can offer based on your description is to check your classpath and ensure that the jar file that houses the driver class is on it.

I was thinking that it was something along those lines, but I'm pretty sure I tried that.

One thing I'm a little unclear on is should this classpath be entered in the Control Panel/System/Environment Variables thing, or should it be through the Java Admin Console? The Java Console has like three different spots for classpaths for different situations (although I did try all of them, to no avail).
 

Hitman

Edmonton's milkshake attracts no boys.
I'm taking beginner's Java.. cna one of you guys do ym assignment for me? :)
 

CaptainABAB

Member
Vlad - is this your own java app or are you creating something within an app server? I'm not familiar with PointBase - is that what you are using?

Normally, my classpath is in the same command where I run the java program...

Example:
java -cp c:\lib\JDBCdriver.jar;. MyClass
 

Slo

Member
Vlad, you can either set the classpath in your system's environement, in a command prompt that you plan to call java from, or in the IDE you are using. What IDE are you working with? Eclipse?
 

Vlad

Member
Slo said:
Vlad, you can either set the classpath in your system's environement, in a command prompt that you plan to call java from, or in the IDE you are using. What IDE are you working with? Eclipse?

Heh, just as I come in here to tell everybody that I figured it out, too.

That was exactly the problem. Even though I set the classpath through Control Panel, JBuilder didn't recognize it or something. Once I told JBuilder where to look when running the program, it all started working just fine.

Hitman said:
I'm taking beginner's Java.. cna one of you guys do ym assignment for me?

No, but I can offer hints if you're having trouble.. it'll be nice to go back to something simpler than this stuff :)
 
Status
Not open for further replies.
Top Bottom