This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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
Sheriff

Joined: Oct 14, 2005
Posts: 19728
    
  10

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
Sheriff

Joined: Oct 14, 2005
Posts: 19728
    
  10

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
Sheriff

Joined: Oct 14, 2005
Posts: 19728
    
  10

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
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32508
    
214

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!


[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
 
Have you checked out Aspose?
 
subject: Unable to load the JDBC driver
 
It's not a secret anymore!