ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinaya Tirikkovalluru" <vinaya.tirikkovall...@converge.com>
Subject RE: Calling procedures from 2 different databases
Date Fri, 26 Oct 2007 14:12:41 GMT
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: erlend.bjorge@aftenposten.no [mailto:erlend.bjorge@aftenposten.no]

Sent: Friday, October 26, 2007 4:08 AM
To: user-java@ibatis.apache.org
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:jeffgbutler@gmail.com] 
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 <vinaya.tirikkovalluru@converge.com
<mailto:vinaya.tirikkovalluru@converge.com> > 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.

Mime
View raw message