vendredi 5 juin 2015

DB2 database connection with Hibernate, JPA, JDBC

I'm quite new to the subject and I'd like to know what is wrong with what I've done so far.

So to establish the database connectioin I created a persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
             xmlns="http://ift.tt/UICAJV" xmlns:xsi="http://ift.tt/ra1lAU"
             xsi:schemaLocation="
        http://ift.tt/UICAJV
        http://ift.tt/O9YdEP">
    <persistence-unit name="Primary">
        <class>xxx.model.Lecture</class>
        <properties>
            <property name="javax.persistence.jdbc.driver" value="com.ibm.db2.jcc.DB2Driver" />
            <property name="javax.persistence.jdbc.url"    value="jdbc:db2://localhost:50000/xxx" />
            <property name="javax.persistence.jdbc.user" value="xxx" />
            <property name="javax.persistence.jdbc.password" value="xxx" />
            <property name="hibernate.dialect" value="org.hibernate.dialect.DB2Dialect"/>
            <property name="show_sql" value="true"/>
            <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false"/>
        </properties>
    </persistence-unit>
</persistence>

... and included the driver .jar: db2jcc4.jar

When running the app I get the following error:

org.apache.derby.client.am.SqlException: Schema 'DB2ADMIN' does not exist.

So did I miss something essential?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire