-
1. Re: Connection problem to mySQL database
peterj Mar 25, 2010 11:18 AM (in response to microbe)You should be acccessing a database connection via the connection pool manager. Do this instead:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:MySQLDB"); // Name used in *-ds.xml file
Connection conn = ds.getConnection(); -
2. Re: Connection problem to mySQL database
microbe Mar 26, 2010 4:35 AM (in response to peterj)Thanks for a such response, but it doesn't work yet.
I tryied your solution, and it doesn't work, there is a problem in connection in these two lines :
DataSource ds = (DataSource)ctx.lookup("java:MySQLDB"); // Name used in *-ds.xml file
Connection con = ds.getConnection();
ds contain "org.jboss.resource.adapter.jdbc.WrapperDataSource@109afb8"
I substitued MySQLDB by the name in the xml (which is MySQLDB =] )
Where the problem may come from, maybe I forgot an important step...
-
3. Re: Connection problem to mySQL database
peterj Mar 26, 2010 7:26 AM (in response to microbe)If ds contains a WrapperDataSource, then the lookup succeeded, in which case you should be given a connection. Unless your *-ds.xml has incorrect connection information. Please post the exception stack trace.
-
4. Re: Connection problem to mySQL database
microbe Mar 26, 2010 10:28 AM (in response to peterj)Here is the principal error :
15:15:22,548 WARN [loggerI18N] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.disallow] Adding multiple last resources is disallowed. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@339dd9
15:15:22,552 ERROR [STDERR] org.jboss.util.NestedSQLException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:e017:4bacc11e:1ec status: ActionStatus.ABORT_ONLY >); - nested throwable: (org.jboss.resource.JBossResourceException: Could not enlist in transaction on entering meta-aware object!; - nested throwable: (javax.transaction.SystemException: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 7f000101:e017:4bacc11e:1ec status: ActionStatus.ABORT_ONLY >))at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:95)