ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <lmead...@apache.org>
Subject Re: Multiple Databases - Multiple Context
Date Wed, 05 Oct 2005 14:12:53 GMT
Uhm, by using the id attribute?

<context id="blah">
  ...
</context>

That is the easiest way to have two seperate sets of DAO classes -
i.e., setting up oracle and M$SQL, for instance.

Another approach to this is to pass properties into the
DaoManagerBuilder at runtime, that is the easiest way to have the
exact same set of dao classes with just different database
connections.

Larry


On 10/5/05, Agilan Palani <agilan@bntasia.com> wrote:
>
>
>
> Hi
>
>
>
>             I need Ibatis to provide access to two different databases.
>
>             After going through the forums I found that it can be achieved
> by
>
>             1. Configuring two <context> tags in the dao.xml,
>
> 2. While getting the DAO objects, use the following method
>
>             getDaoManager().getDao(UserDAO.class, contextId ) to retrieve
> the objects,
>
>             they would access the correct database defined for that context.
>
>
>
>             Question here is how do I define/declare a contextId to the
> <context> ?
>
>             I checked the
> http://www.ibatis.com/dtd/dao-2.dtd and there is no way
> that
>
> I can specify an ID to the context tag.
>
>
>
> Is there any other way to do this?
>
>
>
>
>
> Thanks in advance
>
> Agilan

Mime
View raw message