ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <novo...@gridsphere.org>
Subject Re: how to get db metadata + dynamic spring config
Date Wed, 25 Jun 2008 03:17:49 GMT


    Thanks for that tip. My other dilemma is that I normally would use 
spring ibatis configuration but hat works fine when I generally have a 
single connection to a known database e.g.

<bean id="dataSource1" destroy-method="close" 
        <property name="driverClassName" value="${jdbc1.driverClassName}"/>
        <property name="url" value="${jdbc1.url}"/>
        <property name="username" value="${jdbc1.username}"/>
        <property name="password" value="${jdbc1.password}"/>

    <bean id="sqlMapClient1" 
        <property name="configLocation" 
        <property name="dataSource" ref="dataSource1"/>

    <bean id="testService" 
        <property name="sqlMapClient" ref="sqlMapClient1"/>

In my current situation, I have an unknown number of databases that I 
can determine from the INFORMATION_SCHEMA and they all have the same 
table structure-- so I  then need to presumably (re)create 10 different 
BasicDataSource's with 10 SqlMapClients (and apparently 10 testServices 
as well) (basically rejigger the sqlMapClient and BasicDataSource 
initially loaded by spring) (I don't need all 10 at once-- I can create 
each of the dataSource, sqlMapClient, testService one at a  time for 
each of the databases). Any thoughts on how to do this? It sounds pretty 
painful since it seems Spring is best suited for static configuration...

    Thanks again, Jason

Toby Thain wrote:
> On 24-Jun-08, at 10:45 PM, Jason Novotny wrote:
>> Hi,
>>    I'm converting a nasty python script to java and they use the 
>> database metadata to determine the list of databases (the equivalent 
>> of a "show databases;" MySql command) and then connect to the 
>> appropriate one before querying on tables. Is there a way to do this 
>> using iBatis?
> --Toby
>>    Thanks, Jason

View raw message