While waiting for feedback on the above, I decided to try approach number 2
It will use this persistence.xml file (contrary to the above post, I uncommented the node "jta-data-source" ):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<persistence version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
xmlns:orm="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/processInstanceDS</jta-data-source>
<class>org.drools.persistence.info.SessionInfo</class>
<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
<class>org.drools.persistence.info.WorkItemInfo</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup"/>
</properties>
</persistence-unit>
</persistence>
I try to initiate the database connection like proposed in the jBPM documentation:
PoolingDataSource ds = new PoolingDataSource();
ds.setUniqueName("jdbc/processInstanceDS");
ds.setClassName("net.sourceforge.jtds.jdbc.Driver");
ds.setMaxPoolSize(3);
ds.setAllowLocalTransactions(true);
ds.getDriverProperties().setProperty("user", "myUser");
ds.getDriverProperties().setProperty("password", "myPassword");
ds.getDriverProperties().put("URL", "jdbc:jtds:sqlserver://192.168.117.129:1433;databaseName=myDatabase");
ds.init();
But when I start everything, the above code crashes with:
...
Caused by: bitronix.tm.utils.PropertyException: no writeable property 'URL' in class 'net.sourceforge.jtds.jdbc.Driver'
at bitronix.tm.utils.PropertyUtils.getSetter(PropertyUtils.java:318)
at bitronix.tm.utils.PropertyUtils.setDirectProperty(PropertyUtils.java:217)
at bitronix.tm.utils.PropertyUtils.setProperty(PropertyUtils.java:83)
at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:314)
at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:63)
at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:85)
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:72)
... 58 more
I looked this up on the net for a while and found that I could defin each parts of the URL in separate components like this (Though I have no clue as to how the connection will be initiaterd since the server type is not provided):
...
ds.getDriverProperties().setProperty("serverName", "192.168.117.129");
ds.getDriverProperties().setProperty("portNumber", "1433");
ds.getDriverProperties().setProperty("databaseName", "racm_identity_data");
In anycase, this also crashes with:
Caused by: bitronix.tm.utils.PropertyException: no writeable property 'user' in class 'net.sourceforge.jtds.jdbc.Driver'
at bitronix.tm.utils.PropertyUtils.getSetter(PropertyUtils.java:318)
at bitronix.tm.utils.PropertyUtils.setDirectProperty(PropertyUtils.java:217)
at bitronix.tm.utils.PropertyUtils.setProperty(PropertyUtils.java:83)
at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:314)
at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:63)
at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:85)
at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:72)
... 58 more
So with one technique or the other, I always get countered by some obscure problems time after time