ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gwyn Evans" <gwyn.ev...@gmail.com>
Subject Re: connections to different databases
Date Mon, 31 Jul 2006 11:58:32 GMT
It certainly looks so - I've only got a Spring setup, though...
    <bean id="dataSource"
        <property name="jndiName"><value>${jndi.name}</value></property>

    <bean id="sqlMapClient"
        <property name="configLocation" value="classpath:sqlMapConfig.xml"/>
        <property name="dataSource" ref="dataSource"/>

    <!-- setup dao implemations -->
    <bean id="adminDaoImpl" class="package.dao.impl.AdminDaoImpl">
        <property name="sqlMapClient" ref="sqlMapClient"/>
    <bean id="configDaoImpl" class="package.dao.impl.ConfigDaoImpl">
        <property name="sqlMapClient" ref="sqlMapClient"/>

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.


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

View raw message