Using the standard jconn3 sybase driver (the jtds driver is fine), I'm
getting this error when attempting to get a List the following way
without only adding default stuff (username, etc)

        SqlSession session = SqlSessions.metaDbSessionFactory.openSession();
        SampleMapper mapper = session.getMapper(SampleMapper.class);
        try {
             return mapper.getSamples();
        } finally {
            session.close();
        }

 with jconn3 causes:

org.apache.ibatis.exceptions.IbatisException:
### Error closing transaction.  Cause:
org.apache.ibatis.transaction.TransactionException: Error configuring
AutoCommit.  Your driver may not support getAutoCommit() or
setAutoCommit(). Cause: com.sybase.jdbc3.jdbc.SybSQLException: SET
CHAINED command not allowed within multi-statement transaction.

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

Using the jtds driver things are fine.

After googling for a while I found some info related to sybase and
this issue https://forum.hibernate.org/viewtopic.php?f=1&t=930864&start=0

And at the bottom of that post I did what was mentioned and when I set
the datasource with:

"SERVER_INITIATED_TRANSACTIONS",  "false"

And THINGS WORKED!

BUT, my question is what drawback does this have and should I consider
a different approach to my ibatis queries? Also, why would it think
it's doing a multi-statement transaction? The query is just:

<sql id="sampleSql">
        select sampleTypeKey, sampleDesc from Sample
    </sql>

<select id="getSamples" resultType="Sample">
        <include refid="sampleSql"/>
        order by sequenceNumber
    </select>

The sybase docs mention:

SERVER_INITIATED_TRANSACTIONS


This property allows the server to control transactions. By default,
the property is set to true, and jConnect allows the server to start
and control transactions by using Transact-SQL® set chained on. If the
property is set to false, the transactions are started and controlled
by jConnect using transact sql begin tran. Sybase recommends that you
allow the server to control the transactions.


Default: True

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org
For additional commands, e-mail: user-java-h...@ibatis.apache.org

Reply via email to