This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate " Watch "No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate " New topic
Author

No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate

Amrit pandey
Greenhorn

Joined: Jun 28, 2010
Posts: 19
Hi I am new to Hibernate.. I have written my first hibernate program in eclipse but when I am running it its throwing following exception in cosole



Here are the codes for hibernate.cfg and PersonManager.java files:

=================<1> hibernate.cfg.xml======================

==================================================================

2] PersonManager.java file [Person is a Pojo class having getters and setters for its attributed (code not pasting here), PersonManager provides configuration to hibernate and perform DB actions]

================== PersonManager.java===========================


===========================================================

Important:
1> I have added
ojdbc14.jar and other required jar files
in project's build path
2> I am using Oracle 10 G database


Waiting eagerly for your reply.

Thanks in Advance..
Amrit Pandey


Thanks & Regards,
Amrit Pandey
Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

Shouldn't this be ??


Googling doesn't make you a genius. But not Googling makes you dumber.
Amrit pandey
Greenhorn

Joined: Jun 28, 2010
Posts: 19
Hi Prabharan, thanks for your prompt reply!!

I was not aware of the format you suggested so I googled and found a link [ http://www.orafaq.com/wiki/JDBC ] with relevant information that gave me clue what you meant to convey. Then I came to know about TNSNAMES.ORA file [ link http://www.orafaq.com/wiki/Tnsnames.ora ], when I opened this file I found that I was giving wrong HOST name. Here is the code in TNSNAMES.ORA file

================TNSNAMES.ORA=========================


============================================================

I tried multiple combination for connection.url property but with no luck. I tried below combination:



and


but still getting No suitable driver found for oracle:jdbc:thin:@//AmritP.nbin.local:1521/XE Or No suitable driver found for oracle:jdbc:thin:@AmritP.nbin.local:1521:XE respectively for above two combination.

Please suggest !!
Amrit pandey
Greenhorn

Joined: Jun 28, 2010
Posts: 19
With further curiosity, I wrote a JDBC program using oracle driver and used the same url what I was putting in hibernate.cfg file. The program was running fine without any exception. Here is the connection I used in my jdbc program [I changed <HOST> value in TNSNAMES.ORA file from "AmritP.nbin.local" to "localhost"]



As the URL in both the places [JDBC program/ hibernate.cfg] are same , can there any problem with loading of "OracleDriver" in hibernate (as we are not using class.forename() explicitly in hibernate- just a guess) ??

Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

Amrit, what i said earlier, I'm saying now. In your JDBC program, you have the connection url as "jdbcracle:thin:@localhost:1521:XE", and in your hibernate cfg file, it is "oracle:jdbc:thin:@localhost:1521:xe". Can you spot the difference?
Amrit pandey
Greenhorn

Joined: Jun 28, 2010
Posts: 19
Hmmmm.... Got your point.. Many many thanks Prabhaharan!! Committing this kind of mistake is a crime...Such a silly mistake!! I changed the URL , now I am not getting that issue but still I am getting other issues related to cglib library. If you see the 1st error log I had posted, was another exception that was being thrown


I updated the build path with "cglib2.2.jar". Later I was getting "asm" related exception which was resolved by updating the build path with the jar "asm-4.0.jar". Now there is a new exception that is thrown when I am trying to run the application. The error trace is:


 
GeeCON Prague 2014
 
subject: No suitable driver found for oracle:jdbc:thin:@localhost:1521:xe Exception ;Hibernate