Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 66
VI Editor Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shouldn't this be ??
 
Amrit pandey
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
VI Editor Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amrit, what i said earlier, I'm saying now. In your JDBC program, you have the connection url as "jdbc:oracle: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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic