Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Amrit pandey
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Prabaharan Gopalan
Ranch Hand
Posts: 66
Java Linux VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shouldn't this be ??
 
Amrit pandey
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
Java Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic