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: connections to different databases
Date Mon, 31 Jul 2006 14:19:48 GMT
I would not reccomend trying to use a single instance for two
databases - just create two.

Remember, you can pass a properties object into the sqlmap client
builder to customize the created sql map client.

Larry


On 7/31/06, Mkhitaryan, Aram <Aram.Mkhitaryan@lycos-europe.com> wrote:
> Oh, I have never used IBATIS with Spring.
>
> I was talking about custom implementation/handling sqlmap client or daomanager.
>
> But I think there should be another configuration for this case.
>
> If I find useful documentation I will send the link.
>
> Best,
> Aram
>
> -----Original Message-----
> From: Gwyn Evans [mailto:gwyn.evans@gmail.com]
> Sent: Monday, July 31, 2006 4:59 PM
> To: user-java@ibatis.apache.org
> Subject: Re: connections to different databases
>
> It certainly looks so - I've only got a Spring setup, though...
> e.g.
>     <bean id="dataSource"
> class="org.springframework.jndi.JndiObjectFactoryBean">
>         <property name="jndiName"><value>${jndi.name}</value></property>
>     </bean>
>
>     <bean id="sqlMapClient"
> class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
>         <property name="configLocation" value="classpath:sqlMapConfig.xml"/>
>         <property name="dataSource" ref="dataSource"/>
>     </bean>
>
>     <!-- setup dao implemations -->
>     <bean id="adminDaoImpl" class="package.dao.impl.AdminDaoImpl">
>         <property name="sqlMapClient" ref="sqlMapClient"/>
>     </bean>
>     <bean id="configDaoImpl" class="package.dao.impl.ConfigDaoImpl">
>         <property name="sqlMapClient" ref="sqlMapClient"/>
>     </bean>
>
> In the above, I'm using a shared dataSource, but the DaoImpls extend
> Spring's SqlMapClientDaoSupport, which also supports a "dataSource"
> property, so I'd expect to be able to remove it from the
> "sqlMapClient" bean and add Dao-specific ones to the DaoImpl beans.
>
> /Gwyn
>
> On 31/07/06, Eugeny N Dzhurinsky <bofh@redwerk.com> wrote:
> > Hello!
> > Is it possible somehow to use several databases for single SqlMapClient
> > instance?
> >
> > For example, I would like to use queries in namespace "spider" to be executed
> > on MySQL, and queries in the reset namepaces to be executed on PostgreSQL, w/o
> > creating 2 instances of SQL map clients.
> >
> > --
> > Eugene N Dzhurinsky
> >
>

Mime
View raw message