JBoss Community

Re: jBPM 5.1 with SQL Server

created by Marco Rietveld in jBPM - View the full discussion

Dominique,

 

You're almost there!

 

See here for the all of the code from the following segment, but the following should work for SQL server:

 

PoolingDataSource pds = new PoolingDataSource();

 

// The name must match what's in the persistence.xml!

pds.setUniqueName("jdbc/testDS1");

 

//

pds.setClassName("com.microsoft.sqlserver.jdbc.SQLServerXADataSource");

 

// doesn't really matter

pds.setMaxPoolSize(3);

 

pds.getDriverProperties().put("user", "thisIsMyUsername");

pds.getDriverProperties().put("password", "thisIsMyPassword");


for (String propertyName : new String[] { "serverName", "portNumber", "databaseName" })

 

pds.getDriverProperties().put("serverName", "The.Server.Name.as.in.DNS.Name");

pds.getDriverProperties().put("portNumber", "portNumber);

pds.getDriverProperties().put("databaseName", "NameOfTheDatabase");

 

pds.getDriverProperties().put("URL", "jdbcUrl");

pds.getDriverProperties().put("selectMethod", "cursor");

pds.getDriverProperties().put("InstanceName", "ThisIsTheInstanceNameOfYourDatabase-sortOfLikeTheDatabaseName");

 

pds.init();

 

EntityManagerFactory emf = Persistence.createEntityManagerFactory("persistenceUnitName");

 

Also, the jta-data-source element should not be commented out in your persistence.xml, obviously.

Reply to this message by going to Community

Start a new discussion in jBPM at Community