Hi Guys,
** Update ** I'd read the second post first.
Using JDeveloper 12.1.2.0.0 and integrated WebLogic server of the same version.
I've got an ADF program where one project of the application uses JDBC in a message bean. If I create an Application Module within the same project and then connect using its connection (java:comp/env/jdbc/MyAdfConnDS), then the code below works just fine. However, if I lookup the JDBC connection (jdbc/MyJdbcDS) I configured in WebLogic myself, then I get distributed transaction errors. How can I setup my JDBC connection to emulate the one that the AppModule creates? That way I can execute prepared statements and call commit explicitly?
Here is my JDBC code
conn.setAutoCommit(false);
PreparedStatement statement = conn.prepareStatement(sql);
statement.setLong(1, companyAccountId);
// errors here
statement.execute();
conn.commit();
statement.close();
Resulting in the error
// prepared statement.
DELETE BUSINESS_PARTNERS WHERE MASTER_TYPE_KEY = 'C' AND COMPANY_ACCOUNT_ID = ?
java.sql.SQLException: Cannot call commit when using distributed transactions
at weblogic.jdbc.wrapper.JTAConnection.commit(JTAConnection.java:373)
at com.sample.myProduct.jms.clients.MyClient.deleteEntities(MyClient.java:211)
at com.sample.myProduct.jms.clients.MyClient.importData(MyClient.java:155)
at com.sample.myProduct.jms.beans.ImportMessageBean.onMessage(ImportMessageBean.java:91)
at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:575)
at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:375)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4855)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:4529)
at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3976)
at weblogic.jms.client.JMSSession.access$000(JMSSession.java:120)
at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5375)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
Here's a screenshot of all the drivers available: www.williverstravels.com/JDev/Forums/Threads/3544909/drivers.png as well as the transaction configuration screen www.williverstravels.com/JDev/Forums/Threads/3544909/config.png
I've tinkered enough to feel pretty strongly it's not a coding error, but rather something in Weblogic. I've read what I can, but I don't know how the AppModule creates connections. I'd hate to add an AppModule just to grab its data source / connection information if I don't need to.
Ideas?