〉〉It sounds like it can't be done in an application that has a base data
access class that all other data access implementations inherit from.

 

It depends on what your base data access class looks like~~~~~I suggest your
data access class can takes an ISqlMapper instance as a constructor
parameter, or better, applies the factory pattern for the creation of the
data access classes.

 

>> It would be really nice if the datasource could be set on a map file by
map file basis.

I don’t understand what u really mean L

The datasource is set in SqlMap.xml, for a multi database application, you
should have multiple SqlMap.xml files, and the datasource element in each
SqlMap.xml points to a different database.

 

发件人: Vincent Apesa [mailto:[EMAIL PROTECTED] 
发送时间: 2008年1月26日 22:41
收件人: [email protected]; [EMAIL PROTECTED]
主题: Re: Multiple Datasources?

 

It sounds like it can't be done in an application that has a base data
access class that all other data access implementations inherit from.

 

It would be really nice if the datasource could be set on a map file by map
file basis.

 

Vince

----- Original Message ----- 

From: smartkid <mailto:[EMAIL PROTECTED]>  

To: [email protected] 

Sent: Saturday, January 26, 2008 2:19 AM

Subject: 答复: Multiple Datasources?

 

Hi, 

 

1.       Creates a SqlMap.xml and data maps for each database.

2.       Creates a DomSqlMapBuilder instance for each database.

3.       Call DomSqlMapBuilder.Configure(…) with the corresponding
SqlMap.xml for each instance.

4.       Use the ISqlMapper instances returned from the previous step for
accessing a certain database.

 

 

Pseudo code:

 

DomSqlMapBuilder builderA = new DomSqlMapBuilder();

ISqlMapper mapperA = builderA.Configure(“sqlMap_A.xml”);

 

DomSqlMapBuilder builderB = new DomSqlMapBuilder();

ISqlMapper mapperB = builder.Configure(“sqlMap_B.xml”);

 

 

Smartkid

 

发件人: Nathan O. Miller [mailto:[EMAIL PROTECTED] 
发送时间: 2008年1月26日 2:38
收件人: [email protected]
主题: Multiple Datasources?

 

Hello everyone,

 

I have a web application that contains individual tools that each use their
own database.  Is there some way for IBatis to support the use of multiple
datasources for something like this?  

 

Thanks,

Nathan Miller

Reply via email to