Hi Larry,
 
Thank you so much...
It is working fine.
Here is my implementation. It may be useful for others.
 
SQLMapconfig.xml
---------------------------
 
<transactionManager type="JDBC">
    <dataSource type="SIMPLE">
        <property name="JDBC.Driver" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="JDBC.ConnectionURL" value="jdbc:oracle:thin:@machname:1521:sid"/>
        <property name="JDBC.Username" value="${username}"/>
        <property name="JDBC.Password" value="${password}"/>
        <property name="JDBC.DefaultAutoCommit" value="true" />
        <property name="Pool.MaximumActiveConnections" value="10"/>
        <property name="Pool.MaximumIdleConnections" value="5"/>
        <property name="Pool.MaximumCheckoutTime" value="120000"/>
    </dataSource>
  </transactionManager>
 
And passing the value through property file while builing dao manager.
 
   Properties props = new Properties();
   props.put("username", userName);
   props.put("password", password);
   return DaoManagerBuilder.buildDaoManager(reader, props);.
 
Thanks
Vijai Senthil
 
----- Original Message -----
From: "Larry Meadors" <[EMAIL PROTECTED]>
To: "Vijai Senthil Padmanabhan Kalaiyarasi" <[EMAIL PROTECTED]>
Sent: Wednesday, September 28, 2005 4:05 PM
Subject: Re: Passing logged in Username and password to iBATIS

> When you create the sql map client, you can pass in a properties
> object (at runtime)..you may be able to create a sqlmap client
> instance per user this way.
>
> I am not positive if we have the same functionality for the DAO layer
> (i.e., passing in propeties at run time). If so, that might be a
> potential solution.
>
> Another potential solution would be to use something like this:
>
>
http://cvs.sourceforge.net/viewcvs.py/ibatisdb/contributed/ibatis-dbl-2/threaduserdatasource/
>
> NOTE: The threaduserdatasource code is *completely* *unsupported*. It
> uses a ThreadLocal variable to pass user credentials to the data
> source, so that the data source can then return a connection that is
> for the user that is requesting the work.
>
> Larry
>
>
> On 9/28/05, Vijai Senthil Padmanabhan Kalaiyarasi
> <
[EMAIL PROTECTED]> wrote:
>>
>> 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);
>>
>>
>>         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)
>>
>>     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]>
>> To: <
user-java@ibatis.apache.org>
>>
>> Sent: Tuesday, September 27, 2005 3:05 PM
>> Subject: Re: Passing logged in Username and password to iBATIS
>>
>>
>> >I have been down that path, and used proxool to do it.
>> >
>> > 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
>> >>
>> >>

Reply via email to