0

I am using Hibernates without any IDE. I doing on notepad++ text editor. I follow all the steps and worked fine. I set all the jars as classpath. i set classpath foe ojdbc14.jar for my jdk 1.8.0_15. When i run my java file hibernates gives the below error.

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

I use the below line in hibernate.cfg.xml

<session-factory>
..
...
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>  
..
..
</session-factory>

help me to how to resolve this no suitable driver found?

Thanks in advance.

Florian Cramer
  • 1,227
  • 1
  • 16
  • 29
  • Possible duplicate of [SQLException: No suitable Driver Found for jdbc:oracle:thin:@//localhost:1521/orcl](https://stackoverflow.com/questions/12103369/sqlexception-no-suitable-driver-found-for-jdbcoraclethin-localhost1521-or) – Stefan Freitag Feb 26 '18 at 19:29
  • setting all the path and classpath fine. But i dont know where did i do wrong? – Balu Kompalli Feb 26 '18 at 19:31
  • Hai @StefanFreitag, I am not using any Server like Tomcat, JBOSS.. I am just doing a static way of creating xml files, and .java files. Is this really required any Server to work on Hibernate? – Balu Kompalli Feb 26 '18 at 19:40
  • @BaluKompalli are you sure ojdbc.jar in in the classpath when you run your application? – Ivan Feb 26 '18 at 19:51
  • What OS are you using? Also, when you say you "follow[ed] all the steps and [it] worked fine," there's no way for us to spot a mistake if you don't tell us what steps you followed. How, exactly, did you set up your CLASSPATH? – MarsAtomic Feb 26 '18 at 20:13
  • You shouldn't be using `ojdbc14.jar`, that is ancient (for Java 1.4). Please upgrade to a newer version of the driver. See http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html – Mark Rotteveel Feb 27 '18 at 09:51
  • Hai MarsAtomic, I followed all the steps from this link "https://www.javatpoint.com/steps-to-create-first-hibernate-application" and set all the jars to the classpath. Downloaded all the hibernate jars and set those jars in the classpath variable. I am using Windows8.1 OS. – Balu Kompalli Feb 27 '18 at 13:34
  • Hai @Ivan, yes, I set the ojdbc.jar in the classpath. and this jar is worked fine in jdbc connections. – Balu Kompalli Feb 27 '18 at 13:37
  • @MarkRotteveel, But this ojdbc14.jar is worked fine for jdbc connections. Why it is not suitable for Hibernate?could you please tell me? – Balu Kompalli Feb 27 '18 at 13:39
  • You should not be using ancient version of a driver. There are newer versions that 1) have bugs fixed, 2) support newer database features, and 3) support newer JDBC features (eg like JDBC driver auto-loading, which was introduced in Java 6). That last example (driver auto-loading) may well be the problem here. – Mark Rotteveel Feb 27 '18 at 13:43
  • @MarkRotteveel, Which is suitable ojdbc.jar for jdk1.8? – Balu Kompalli Feb 27 '18 at 13:54
  • See the link in my first comment... – Mark Rotteveel Feb 27 '18 at 13:56

0 Answers0