This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Unable to load the JDBC driver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unable to load the JDBC driver" Watch "Unable to load the JDBC driver" New topic
Author

Unable to load the JDBC driver

Nirmal Mukundan
Ranch Hand

Joined: Feb 21, 2007
Posts: 37

Hi

I was trying to execute a java file from Unix. I am using a JDBC connection in this program.


Code:
XXXXX/test/nirmal/Java > ls -lrt

drwxrwxrwx 3 ideasm10 ide 3 Jul 7 11:01 classes
drwxrwxrwx 3 ideasm10 ide 3 Jul 7 11:01 src
drwxrwxrwx 2 ideasm10 ide 3 Jul 7 11:47 lib
-rw-r--r-- 1 ideasm10 ide 71 Jul 7 13:01 sysout.log

From here I give the when I give the command


Code:
java -cp classes com/test/jdbc/InvalidNumberTest
I am getting java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver.

Then I placed the ojdbc14.jar in the lib abd then executed the command


Code:
java -cp classes;lib/ojdbc14.jar com/test/jdbc/InvalidNumberTest
Now I am getting the exception


Code:
Failed to load Main-Class manifest attribute from
lib/ojdbc14.jar.
Can some one please help me to execute the java file.

The same program can be executed from Windows using the same commnds.

Also can you please provide a .sh file wher I can set the classpaths and also execute the java program.

Thanks
Nirmal
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Use colons, not semicolons, to separate entries in your classpath on a Unix system.
Nirmal Mukundan
Ranch Hand

Joined: Feb 21, 2007
Posts: 37

I did not understand. Where are you asking to use the colons. Since I did not use any export command ...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Paul Clapham wrote:Use colons, not semicolons, to separate entries in your classpath on a Unix system.


What I meant by that was to use them in your classpath. That's why I used those words. Do you not see where you set your classpath? Let me point it out more precisely:
java -cp classes;lib/ojdbc14.jar com/test/jdbc/InvalidNumberTest
Nirmal Mukundan
Ranch Hand

Joined: Feb 21, 2007
Posts: 37

Oops ..sorry..I didnt not recognize that..thanks for the quick solution..

I also wanted to know if there is any chat available so as to get expertise on issues quickly?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

There isn't one here. There might be one somewhere else, but I expect if you want experts standing by to answer your questions in real time you might have to pay real money for that.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30130
    
150

Nirmal Mukundan wrote:I also wanted to know if there is any chat available so as to get expertise on issues quickly?

You got an answer in under an hour. That's pretty quick!


[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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to load the JDBC driver
 
Similar Threads
Setting up a JDBC connection
NoClassDefFoundError
thin driver / classpath / jdk1.4
Java and ORACLE XE connectivity Problem
i'm so frustrated......deployment issue