Hi Larry,
I have included this piece of
code before getting the DAO infstance from DAOManager.
SqlMapDaoTransaction trans = (SqlMapDaoTransaction)
daoManager.getTransaction(daoManager.getDao(daoClass));
SqlMapClient sqlMapClient = trans.getSqlMap();
Connection conTemp = sqlMapClient.getDataSource().getConnection("test", "test");
sqlMapClient.setUserConnection(conTemp);
SqlMapClient sqlMapClient = trans.getSqlMap();
Connection conTemp = sqlMapClient.getDataSource().getConnection("test", "test");
sqlMapClient.setUserConnection(conTemp);
daoManager.getDao(daoClass);
I thought of substituting the
connection in the sqlmap with my own connection.
But it gave me error
like
Cause:
com.ibatis.sqlmap.engine.transaction.TransactionException: TransactionManager
could not end this transaction. A user provided connection
is currently being used by this session. You must call
the rollback() method of the Connection directly. The calling
.setUserConnection (null) will clear the user provided
transaction.
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:471)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:134)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:107)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:134)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:107)
Is there any other round about
to do this? So that the SQL statements will be executed with the user supplied
connection.
Thanks and regards
Vijai Senthil P K
----- Original Message -----
From: "Larry Meadors" <[EMAIL PROTECTED]>
Sent: Tuesday, September 27, 2005 3:05
PM
Subject: Re: Passing logged in Username and
password to iBATIS
>
> I would *not* recommend doing this.
>
> It will be easier to change the procedures to allow passing in the user id.
>
> We did something similar, in that we made them default to USER if a
> user parameter is not passed in, and if the user is the iBATIS userid,
> they fail. That forces callers to use either a trusted (i.e., Oracle)
> connection, or supply a user.
>
> Larry
>
>
> On 9/27/05, Vijai Senthil Padmanabhan Kalaiyarasi
> <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I am working on a re-enginerring project from Oracle forms to J2EE.
>> There are several DB procedures using the USER variable of Oracle.
>>
>> So I am forced to get a connection for the logged in Username and
>> password.
>> How can I tell the iBATIS to execute my statements in the connection
>> created by the logged in Username and password?
>> Is there any method to do that?
>>
>> Thanks and Regards
>> Vijai Senthil P K
>>
>>