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...
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