File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes JDBC & Eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "JDBC & Eclipse" Watch "JDBC & Eclipse" New topic

JDBC & Eclipse

Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Hi all,

I believe this is common problem that has been answered, but I was unable to find anything real clear in the forums. I have been using TextPad to do all my coding and thought I would try eclipse. However, when I run the exact same app that works just fine through the command line with Eclipse I get the following error:

Being new to eclipse, I am assuming I have to add the JDBC connection information to the project, but have no idea what I am doing wrong. I did the project->properties->libraries->add class folder, which i select the said oracle folder for
DriverManager.registerDriver(new oracle.rdb.jdbc.rdbThin.Driver());

folder stucture is like so:

oracle\rdb\jdbc - rdbThin (Driver() is in here)
- common
- util

Any Ideas?


[ December 19, 2005: Message edited by: Joe Schider ]

SCJP, SCJD(In Progress)<br /> <br />"They whom make no mistakes usually make nothing at all."
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Did you add a specific jar to the classpath or just the Oracle folder? You need to tell Eclipse about a specific jar.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Do you have to use a jar or can you add folders also? After playing with it a bit, I was able to get it to work with a jar, but the jar is just the folder structure compressed. If there is a way to add folders containing the needed classes I would like to know.

Thanks for the help,

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

If you add folders, you'd need to add the directory that contains the top-level "oracle" directory, not the oracle directory itself.

[Jess in Action][AskingGoodQuestions]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

You add directories using the "Add Class Folder" button on the project build libraries page.

However, it looks like you're attempting to work with an exploded copy of the oracle driver jar. Why not just include ojdb14.jar or classes12.jar as library jars for the project?

An IDE is no substitute for an Intelligent Developer.
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38

Well I don't have to add the folders, and I know the benefits of jar, but I was just trying to see if the situation required that I could just add the class folders and jar the whole project and then just update the main-class in the manifest. This would give me a self contained executable that I could send to my non-tech internal customers. If you have a better way, possibly a a jar of jars, I would like to hear about it.

Thanks again,

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
For the "jar in a jar" solution take a look at

But be careful - as far as I know, redistributing the oracle jar file actually is illegal - and repackaging it probably doubly so.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Thanks for the link. Very interesting. As far as illegal activity, when I say
send to my non-tech internal customers
, I was just 'trying' to say co-workers (all of whom have oracle on their PC's) in a fancy way. So, I hope that doesn't call for more Sheriff activity.

[ December 22, 2005: Message edited by: Joe Schider ]
I agree. Here's the link:
subject: JDBC & Eclipse
It's not a secret anymore!