3

Im trying to configure persistence.xml file which is needed for my EntityManagerFactory. I have created persistence file for MySQL DB a few months ago. But I have a little trouble with Oracle DB.

In MySQL connection I needed MySQL JDBC Connector. It is in Maven repository, so it was easy to fetch it and use. My problem is that I dont know which connector I have to use for connection to Oracle DB. Is that connector in Maven Repository?

Here is my present persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
             version="2.0">

   <persistence-unit name="oracleTest" transaction-type="RESOURCE_LOCAL">   
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" />
            <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe" />
            <property name="javax.persistence.jdbc.user" value="library" />
            <property name="javax.persistence.jdbc.password" value="" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect" />
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        </properties>
    </persistence-unit>
</persistence>
Software Engineer
  • 15,457
  • 7
  • 74
  • 102
G.Spansky
  • 852
  • 6
  • 17
  • 32
  • 2
    I think that will help you : http://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository – Tarik Dec 22 '15 at 09:34
  • 1
    Problem sovled. I downloaded ojdbc6.jar from Oracle site and added it to my Prject Libraries. – G.Spansky Dec 22 '15 at 09:35

0 Answers0