Problems with DataNucleus JDO and MS Sql Server 2012


Max Treptow
 

When I try to read data from a very simple database table on the MS Sql Server 2012 by a DataNucleus JDO query, I get the following error message:

 

Exception in thread "main" javax.jdo.JDODataStoreException: Required table missing : "DBO.MSE" in Catalog "" Schema "DBO". DataNucleus requires this table to perform its persistence operations. Either your MetaData is incorrect, or you need to enable "datanucleus.schema.autoCreateTables"

 

This is the persistence.xml  file, I use to configure the database connection:

persistence-unit name="RdstTest">
        <properties>

 

            <property name="javax.jdo.option.ConnectionURL" value="jdbc:sqlserver://<db_server>:6201;databaseName=rdst;SelectMethod=cursor"/>

 

            <property name="javax.jdo.option.ConnectionDriverName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

 

            <property name="javax.jdo.option.ConnectionUserName" value="<user>"/>

 

            <property name="javax.jdo.option.ConnectionPassword" value="<password>"/>

 

            <property name="javax.jdo.mapping.Schema" value="dbo"/>

 

            <property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>

 

        </properties>

 

    </persistence-unit>

 

And this is the O/R class to map the database table:

 

@PersistenceCapable (identityType = IdentityType.DATASTORE, table = "Mse")

 

public class Mse
{
   

    public Mse() {}   

    @Persistent()
    private String _title; 

 

    public String getTitle() {
        return _title;
    }

    public void setTitle(String title) {
        _title = title;
    }
}

 

 

I tested this with several identity types and Id generator strategies and using 2 different software environments:

 

  1. DataNucleus 3, Java 7, Ant, MS Sql Server 2012, mssql-jdbc-6.4.0.jre7.jar

  2. DataNucleus 5, Java 8, Maven, Sql Server 2012, mssql-jdbc-6.1.0.jre8.jar

All tests without success.

 

Additional information:
1. The access to this table (data reading) using Hibernate (Hibernate 4, Java 8, Maven 3, MS Sql Server 2012, mssql-jdbc-6.1.0.jre8.jar) works fine. So I assume connection parameters and user privileges seem to be correct.
2. Data access to an Oracle 10g database with the same DataNucleus versions (3 and 5, Java 7 and 8) works without any problems too.

 

Because the database table exists and I can read the table content using Hibernate, I’m afraid my O/R class for DataNucleus mapper is wrong.
Could you tell me, what else can I try / what else can I do better to get data access on a MS SQL Server?

 

Thank you in advice

 

 

 

 

Join main@datanucleus.groups.io to automatically receive all group messages.