Hi,

 

I have only one sqlMapConfig file. I use 3 different databases (oracle
servers)

I had a single DAO calling the procedures from the sql.xml file, which
had procedures from different databases

I just need to have one DAO for each database. That worked :-)

 

 

Thanks

Vinaya

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: Friday, October 26, 2007 4:08 AM
To: [email protected]
Subject: SV: Calling procedures from 2 different databases

 

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: [email protected]
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 



This electronic message is intended only for the use of the individual(s) or 
entity(ies) named above and may contain information which is privileged and/or 
confidential.  If you are not the intended recipient, be aware that any 
disclosure, copying, distribution, dissemination or use of the contents of this 
message is prohibited.  If you received this message in error, please notify 
the sender immediately.

Reply via email to