emacarron / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

Error configuring AutoCommit #147

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
3.0.2

Please describe the problem.  Unit tests are best!
We are using the sybase database and using ibatis2.0. Now when we plan to 
upgrade to MyIbatis 3.0. I did the required configuration. Now when I create a 
session without passing the autoCommit argument it works fine but while closing 
the conncetion the exception occurs (see below) and if I create a session by 
passing autoCommit = true I get the following exception 

org.apache.ibatis.transaction.TransactionException: Error configuring 
AutoCommit.  Your driver may not support getAutoCommit() or setAutoCommit(). 
Requested setting: true.  Cause: com.sybase.jdbc2.jdbc.SybSQLException: SET 
CHAINED command not allowed within multi-statement transaction.

    at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:47)
    at org.apache.ibatis.transaction.jdbc.JdbcTransaction.<init>(JdbcTransaction.java:15)
    at org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory.newTransaction(JdbcTransactionFactory.java:15)
    at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSessionFromDataSource(DefaultSqlSessionFactory.java:77)
    at org.apache.ibatis.session.defaults.DefaultSqlSessionFactory.openSession(DefaultSqlSessionFactory.java:36)
    at com.ibatis.dao.client.DaoManager.getSession(DaoManager.java:39)
    at com.ibatis.dao.client.template.SqlMapDaoTemplate.queryForObject(SqlMapDaoTemplate.java:29)
    at com.csfb.ingest.dao.ibatis.smd.SmdLiveDAOImpl.getSedolFromTicker(SmdLiveDAOImpl.java:30)
    at com.csfb.ingest.dao.ibatis.smd.SmdLiveDAOImplTest.test1getSedol(SmdLiveDAOImplTest.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:243)
    at junit.framework.TestSuite.run(TestSuite.java:238)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: SET CHAINED command not 
allowed within multi-statement transaction.

    at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2834)
    at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2156)
    at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:220)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:203)
    at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1702)
    at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1685)
    at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedStatement.java:104)
    at com.sybase.jdbc2.tds.Tds.setOption(Tds.java:1194)
    at com.sybase.jdbc2.jdbc.SybConnection.setAutoCommit(SybConnection.java:986)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.ibatis.datasource.pooled.PooledConnection.invoke(PooledConnection.java:225)
    at $Proxy0.setAutoCommit(Unknown Source)
    at org.apache.ibatis.transaction.jdbc.JdbcTransaction.setDesiredAutoCommit(JdbcTransaction.java:42)
    ... 27 more

What is the expected output? What do you see instead?

No exception should be able to se create session with autoCommit True or close 
session without exception.

Please provide any additional information below.

The configuration settings are 

<configuration>
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"/>
                <dataSource type="POOLED">
                    <property value="com.sybase.jdbc2.jdbc.SybDriver" name="driver"/>
                    <property value="url" name="url"/>
                    <property value="xxxxx" name="username"/>
                    <property value="xxxxxx" name="password"/>
                    <property value="15" name="poolMaximumActiveConnections"/>
                    <property value="15" name="poolMaximumIdleConnections"/>
                    <property value="1000" name="poolTimeToWait"/>
                </dataSource>
        </environment>
    </environments>

Original issue reported on code.google.com by manishsh...@gmail.com on 21 Oct 2010 at 9:07

GoogleCodeExporter commented 9 years ago
This is not duplicated but related to #197

Original comment by eduardo.macarron on 2 Jan 2011 at 3:07

GoogleCodeExporter commented 9 years ago
This issue may have been fixed in r3616. It would be great if the reporter can 
confirm this because I cannot test this with SyBase.

We will reopen the issue if needed.

Original comment by eduardo.macarron on 30 Jan 2011 at 6:19

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 3 Mar 2012 at 9:41