Hi there!

 

>One database per SqlmapConfig - that's the rule.

 

But if your databases and the data is tightly coupled and if you don't need a 
different sqlMapConfig setting setup (don't need ping query, lazyLoadingEnabled 
setting etc)

Wouldn't it be more clean to have one sqlMapConfig file ?

 

Works super for me in a Spring app with connection to a Sybase and MS-SQL 
database, then the connectionUrl, username, password is located in a separated 
java.properties file.

It's small web app with quartz jobs, but it's the most stable application I 
have every made and easy going :-)

 

>In general, you should keep the SQL for the different databases in different 
>XML files - although this is not strictly required.

 

I still have have one sql.xml file for each domain model bean, so if your 
domain model bean contains data from both databases, I don't see it's good 
thing to split it in two different xml's from my point of view. Why split it ? 
Where the data is located, doesn't matter, your domain model bean does :-)

 

Anyway, feel this makes it more easy and less files to handle, from my point of 
view.

 

>So, a particular instance of a DAO is tied to one and only one database.

 

Yes one DAO to one database .....

 

Good luck Vinaya still :-)

 

Erlend

  

 

--

 

Fra: Jeff Butler [mailto:[EMAIL PROTECTED] 
Sendt: 24. oktober 2007 21:51
Til: user-java@ibatis.apache.org
Emne: Re: Calling procedures from 2 different databases

 

One database per SqlmapConfig - that's the rule.

 

If you have two databases, then you need two instances of the SqlMapConfig.  
IIRC you are using Spring, so...

 

1. Declare two datasources

2. Declare two SqlMapConfigs - inject a datasource accordingly

3. Inject the appropriate SqlMapConfig into the appropriate DAO.  So, a 
particular instance of a DAO is tied to one and only one database.

 

In general, you should keep the SQL for the different databases in different 
XML files - although this is not strictly required.

 

Jeff Butler

 

On 10/24/07, Vinaya Tirikkovalluru <[EMAIL PROTECTED] <mailto:[EMAIL 
PROTECTED]> > wrote: 

Hi,

 

I am connected to 2 different databases from the application.

 

How would ibatis know which database to go when I try to access a procedure?

Can I access procedures from 2 databases within the same xml?

 

Thanks in advance

Vinaya 

Reply via email to