ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lamey <cla...@localmatters.com>
Subject Re: How to configure Multiple datasource in SqlMapConfig.xml
Date Thu, 17 Jan 2008 21:38:42 GMT
OK - so you need completely different sqlmaps.

On 1/17/08 2:27 PM, "Jasmin_Mehta@nexweb.org" <Jasmin_Mehta@nexweb.org>
wrote:

> They are completely different schemas and totally different databases - on
> different machines.
> 
> 
> 
> 
> Christopher Lamey <clamey@localmatters.com>
> 01/17/2008 04:23 PM
> Please respond to
> user-java@ibatis.apache.org
> 
> 
> To
> <user-java@ibatis.apache.org>
> cc
> 
> Subject
> Re: How to configure Multiple datasource in SqlMapConfig.xml
> 
> 
> 
> 
> 
> 
> Are they completely different schemas?
> 
> If so, then you'll need two different sqlmaps, DAOs, datasources, etc.  A
> single sqlmap generally only talks to one schema.
> 
> If they're the same and you can switch based on a runtime parameter, take
> a
> look at this:
> 
> http://opensource.atlassian.com/confluence/oss/pages/viewpage.action?pageId=
> 
> 12583003
> 
> Or go with XA.
> 
> Cheers,
> topher
> 
> 
> On 1/17/08 1:48 PM, "Jasmin_Mehta@nexweb.org" <Jasmin_Mehta@nexweb.org>
> wrote:
> 
>> Hi,
>> 
>> In my project, I have to connect to 2 totally different databases and
> run
>> separate queries. How can I define that in SqlMapConfig.xml. The iBATIS
>> config file does not allow multiple <transactionManager> or <dataSource>
>> element according to http://ibatis.apache.org/dtd/sql-map-config-2.dtd.
>> 
>> Also what and how would be property name known to iBATIS in that case.
>> 
>> I have my one of the datasource setup like :
>> 
>>  <properties resource="ResourceParams.properties"/>
>> 
>>   <transactionManager type="JDBC" commitRequired="false">
>>     <dataSource type="SIMPLE">
>>       <property name="JDBC.Driver" value="${driverName}"/>
>>       <property name="JDBC.ConnectionURL" value="${rmsJdbcUrl}"/>
>>       <property name="JDBC.Username" value="${rmsUserName}"/>
>>       <property name="JDBC.Password" value="${rmsPassword}"/>
>>       <property name="JDBC.Class"
>> value="oracle.jdbc.pool.OracleDataSource"/>
>>       <property name="JDBC.Location" value="jdbc/pool/OracleDS"/>
>>       <property name="JDBC.DefaultAutoCommit" value="true" />
>>       <property name="Pool.MaximumActiveConnections" value="10"/>
>>       <property name="Pool.MaximumIdleConnections" value="5"/>
>>       <property name="Pool.MaximumCheckoutTime" value="120000"/>
>>       <property name="Pool.TimeToWait" value="500"/>
>>     </dataSource>
>>   </transactionManager>
>> 
>> 
>> Where ResourceParams.properties has
>> 
>> driverName=oracle.jdbc.driver.OracleDriver
>> 
>> rmsJdbcUrl=jdbc:oracle:thin:@dbHost_1:dbPort_1:dbSid_1
>> rmsUserName=username_1
>> rmsPassword=pwd_1
>> 
>> 
>> otmJdbcUrl=jdbc:oracle:thin:@dbHost_2:dbPort_2:dbSid_2
>> otmdbUserName=username_1
>> otmdbPassword=pwd_1
>> 
>> 
>> How can I configure otmJdbcUrl,  otmdbUserName and otmdbPassword.
>> 
>> And there after how to I map <sqlMap> to each of them with separate
>> resources.
>> 
>> Thanks
>> Jasmin
>> 
> ******************************************************************************
>> ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION
>> Our domain name is changing.  Please take note of the sender's
>> e-Mail address and make changes to your personal address list,
>> if needed.  Both domains will continue to work, only for a limited
>> time.
>> 
> ******************************************************************************
>> This email and any files transmitted with it are intended solely for
>> the use of the individual or agency to whom they are addressed.
>> If you have received this email in error please notify the Navy
>> Exchange Service Command e-mail administrator. This footnote
>> also confirms that this email message has been scanned for the
>> presence of computer viruses.
>> 
>> Thank You! 
>> 
> ******************************************************************************
>> 
> 
> 


Mime
View raw message