3 Replies Latest reply on Jun 2, 2017 9:51 AM by Steven Hawkins

    executeUpdate not working for two different schemas

    Aakash Sen Newbie

      Hi,

       

      I have created 2 connections with names my_SqlTest and testAakshs with databases  aakash_test(MySQL) and aakashs(MySQL) respectively.

      I am executing the query mentioned in below source code on these two connections.

       

      *******************SOURCE CODE***************************

       

       

      String query="INSERT INTO my_SqlTest.aakash_test.\"AADD_TEST\"(my_SqlTest.aakash_test.\"AADD_TEST\".\"date\") select testAakshs.aakashs.\"AADD\".\"date\" from testAakshs.aakashs.AADD LIMIT 0,5";

        Statement stmt = null;

        try {

       

        stmt = connection.createStatement();

      // stmt.addBatch(query);

      // int arrResult[] = stmt.executeBatch();

        int arrResult=stmt.executeUpdate(query);

      // System.out.println("Result===========" + arrResult.length);

        System.out.println("Result===========" + arrResult);

       

        }

       

        catch (Exception e) {

        e.printStackTrace();

        logger.error(e.getMessage(), e);

       

        }

       

       

      When I am running the above code with stmt.executeBatch(); it is working fine.But when I am using stmt.executeUpdate(query); I am getting below exception:.

       

      *****************ERROR LOGS*************

       

       

      org.teiid.jdbc.TeiidSQLException: TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 my_SqlTest: TEIID11009 java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@55bf505a[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@1e5acc4e connection handles=0 lastReturned=1495687371090 lastValidated=1495686837399 lastCheckedOut=1495687371080 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5bf18891 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@22fb8c3c[pool=DSMYSQL20170314124557967] xaResource=LocalXAResourceImpl@3772ae8c[connectionListener=55bf505a connectionManager=103b75d warned=false currentXid=null productName=MySQL productVersion=5.0.67-community-nt jndiName=java:/DSMYSQL20170314124557967] txSync=null]

        at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:135)

        at org.teiid.jdbc.TeiidSQLException.create(TeiidSQLException.java:71)

        at org.teiid.jdbc.StatementImpl.postReceiveResults(StatementImpl.java:723)

        at org.teiid.jdbc.StatementImpl.access$100(StatementImpl.java:65)

        at org.teiid.jdbc.StatementImpl$2.onCompletion(StatementImpl.java:561)

        at org.teiid.client.util.ResultsFuture.done(ResultsFuture.java:135)

        at org.teiid.client.util.ResultsFuture.access$200(ResultsFuture.java:40)

        at org.teiid.client.util.ResultsFuture$1.receiveResults(ResultsFuture.java:79)

        at org.teiid.net.socket.SocketServerInstanceImpl.receivedMessage(SocketServerInstanceImpl.java:285)

        at org.teiid.net.socket.SocketServerInstanceImpl.read(SocketServerInstanceImpl.java:323)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.teiid.net.socket.SocketServerConnectionFactory$ShutdownHandler.invoke(SocketServerConnectionFactory.java:98)

        at com.sun.proxy.$Proxy62.read(Unknown Source)

        at org.teiid.net.socket.SocketServerInstanceImpl$RemoteInvocationHandler$1.get(SocketServerInstanceImpl.java:422)

        at org.teiid.jdbc.StatementImpl.executeSql(StatementImpl.java:570)

        at org.teiid.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1091)

        at org.teiid.jdbc.StatementImpl.executeUpdate(StatementImpl.java:360)

       

       

       

      Caused by: org.teiid.core.TeiidProcessingException: TEIID30504 Remote org.teiid.core.TeiidProcessingException: TEIID30504 my_SqlTest: TEIID11009 java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@55bf505a[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@1e5acc4e connection handles=0 lastReturned=1495687371090 lastValidated=1495686837399 lastCheckedOut=1495687371080 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5bf18891 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@22fb8c3c[pool=DSMYSQL20170314124557967] xaResource=LocalXAResourceImpl@3772ae8c[connectionListener=55bf505a connectionManager=103b75d warned=false currentXid=null productName=MySQL productVersion=5.0.67-community-nt jndiName=java:/DSMYSQL20170314124557967] txSync=null]

        at org.teiid.dqp.internal.process.DataTierTupleSource.exceptionOccurred(DataTierTupleSource.java:401)

        at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:161)

        at org.teiid.query.processor.relational.ProjectIntoNode.checkExitConditions(ProjectIntoNode.java:272)

        at org.teiid.query.processor.relational.ProjectIntoNode.nextBatchDirect(ProjectIntoNode.java:239)

        at org.teiid.query.processor.relational.RelationalNode.nextBatch(RelationalNode.java:282)

        at org.teiid.query.processor.relational.RelationalPlan.nextBatch(RelationalPlan.java:145)

        at org.teiid.query.processor.QueryProcessor.nextBatchDirect(QueryProcessor.java:151)

        at org.teiid.query.processor.QueryProcessor.nextBatch(QueryProcessor.java:114)

        at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:164)

        at org.teiid.query.processor.BatchCollector.collectTuples(BatchCollector.java:146)

        at org.teiid.dqp.internal.process.RequestWorkItem.processMore(RequestWorkItem.java:477)

        at org.teiid.dqp.internal.process.RequestWorkItem.process(RequestWorkItem.java:349)

        at org.teiid.dqp.internal.process.AbstractWorkItem.run(AbstractWorkItem.java:51)

        at org.teiid.dqp.internal.process.RequestWorkItem.run(RequestWorkItem.java:275)

        at org.teiid.dqp.internal.process.DQPWorkContext.runInContext(DQPWorkContext.java:282)

        at org.teiid.dqp.internal.process.ThreadReuseExecutor$RunnableWrapper.run(ThreadReuseExecutor.java:119)

        at org.teiid.dqp.internal.process.ThreadReuseExecutor$3.run(ThreadReuseExecutor.java:210)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

        ... 1 more

      Caused by: org.teiid.core.TeiidException: TEIID11009 Remote org.teiid.translator.TranslatorException: TEIID11009 java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@55bf505a[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@1e5acc4e connection handles=0 lastReturned=1495687371090 lastValidated=1495686837399 lastCheckedOut=1495687371080 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5bf18891 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@22fb8c3c[pool=DSMYSQL20170314124557967] xaResource=LocalXAResourceImpl@3772ae8c[connectionListener=55bf505a connectionManager=103b75d warned=false currentXid=null productName=MySQL productVersion=5.0.67-community-nt jndiName=java:/DSMYSQL20170314124557967] txSync=null]

        at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:282)

        at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:69)

        at org.teiid.translator.ExecutionFactory.getConnection(ExecutionFactory.java:205)

        at org.teiid.dqp.internal.datamgr.ConnectorWorkItem.execute(ConnectorWorkItem.java:331)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at org.teiid.dqp.internal.datamgr.ConnectorManager$1.invoke(ConnectorManager.java:220)

        at com.sun.proxy.$Proxy27.execute(Unknown Source)

        at org.teiid.dqp.internal.process.DataTierTupleSource.getResults(DataTierTupleSource.java:306)

        at org.teiid.dqp.internal.process.DataTierTupleSource.nextTuple(DataTierTupleSource.java:142)

        ... 18 more

      Caused by: java.sql.SQLException: Remote java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@55bf505a[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@1e5acc4e connection handles=0 lastReturned=1495687371090 lastValidated=1495686837399 lastCheckedOut=1495687371080 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5bf18891 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@22fb8c3c[pool=DSMYSQL20170314124557967] xaResource=LocalXAResourceImpl@3772ae8c[connectionListener=55bf505a connectionManager=103b75d warned=false currentXid=null productName=MySQL productVersion=5.0.67-community-nt jndiName=java:/DSMYSQL20170314124557967] txSync=null]

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:146)

        at org.jboss.as.connector.subsystems.datasources.WildFlyDataSource.getConnection(WildFlyDataSource.java:66)

        at org.teiid.translator.jdbc.JDBCExecutionFactory.getConnection(JDBCExecutionFactory.java:278)

        ... 29 more

      Caused by: org.teiid.core.TeiidRuntimeException: Remote javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@55bf505a[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@1e5acc4e connection handles=0 lastReturned=1495687371090 lastValidated=1495686837399 lastCheckedOut=1495687371080 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5bf18891 mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@22fb8c3c[pool=DSMYSQL20170314124557967] xaResource=LocalXAResourceImpl@3772ae8c[connectionListener=55bf505a connectionManager=103b75d warned=false currentXid=null productName=MySQL productVersion=5.0.67-community-nt jndiName=java:/DSMYSQL20170314124557967] txSync=null]

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:933)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:750)

        at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:138)

        ... 31 more

      Caused by: org.teiid.core.TeiidRuntimeException: Remote javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:560)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:928)

        ... 33 more

      Caused by: org.teiid.core.TeiidRuntimeException: Remote javax.transaction.SystemException: IJ000356: Failed to enlist: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 0:ffff0a0a7f65:-3e69bbfa:59265eab:42 status: ActionStatus.ABORT_ONLY >

        at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.checkEnlisted(TxConnectionListener.java:942)

        at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:394)

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:553)

        ... 34 more

       

       

      Note: I am using Wildfly 10.0.0 and teiid 9.1.3

       

       

      Thanks,

      Aakash