File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "JDBC & Eclipse" Watch "JDBC & Eclipse" New topic
Author

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?

Thanks,

Joe
[ 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
Marshal

Joined: May 26, 2003
Posts: 30752
    
156

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


[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
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,

Joe
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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: 16139
    
  21

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?


Customer surveys are for companies who didn't pay proper attention to begin with.
Joe Shy
Ranch Hand

Joined: Dec 09, 2005
Posts: 38
Hello,

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,

Joe
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
For the "jar in a jar" solution take a look at http://one-jar.sourceforge.net/

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.



Joe
[ December 22, 2005: Message edited by: Joe Schider ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC & Eclipse