ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Henricksen" <T...@A-t-g.com>
Subject Trying to use iBatis's connection
Date Wed, 09 May 2007 13:40:10 GMT
We are adding some non iBatis code and trying to tap in to the iBatis
connection for some code analysis purposes.  This works when we run our
code but through builds unit test we get an exception.  Here is some
code examples:

 

Connection connection = mapSession.getCurrentConnection();

 

if (connection == null) {

            mapSession.startTransaction();

            startedTransaction = true;

}

 

            // SAVE SOME things.

 

            if (startedTransaction) {

                                                connection =
mapSession.getCurrentConnection();

                                                connection.commit();

                                    }

 

                        } finally {

                                    if (startedTransaction && mapSession
!= null) {

 
mapSession.endTransaction();

                                                mapSession.close();

                                                mapSession = null;

                                                connection.close();

                                                connection = null;

                                    }

                        }

 

This is the exceptions we get from our unit tests:

 

: com.ibm.db2.jcc.a.SqlException: DB2 SQL error: SQLCODE: -805,
SQLSTATE: 51002, SQLERRMC: NULLID.SYSLH203 0X5359534C564C3031  at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:180)  at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
ForList(GeneralStatement.java:118)  at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:610) 

 

I realize this is kind of a kludge.  I am guessing this isn't
recommended use?  Would you suggest getting our own connection outside
of iBatis?  Is it possible to pull the connection string info (username
and password, etc) out of the iBatis connection?

 

Thanks,

Tom

 


Mime
View raw message