ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "André Bernis" <andreber...@gmail.com>
Subject Using Jboss Properties service with ibatis
Date Wed, 07 Jan 2009 13:58:06 GMT
I need to have an external resource file for the database URL,
password and login in my project instead of using an internal
.properties file as the resource for the SqlMap.config File.
Normally i would use the Jboss Properties service to load my
properties into a configuration class and use this properties to
connect to the database. But i can´t figure out how to do this with
ibatis.
Is there a way to solve this problem? Or i´ll have to create different
compillations of my project for different databases?

As an Example, that´s what i´d like to do in my sqlMap.config file:

<sqlMapConfig>
    <properties resource="*A static object With all the properties*" />

    <transactionManager type="JDBC">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="${driver}" />
            <property name="JDBC.ConnectionURL" value="${url}" />
            <property name="JDBC.Username" value="${username}" />
            <property name="JDBC.Password" value="${password}" />
            <property name="JDBC.DefaultAutoCommit" value="true" />
            <property name="Pool.MaximumActiveConnections" value="10" />
            <property name="Pool.MaximumIdleConnections" value="5" />
            <property name="Pool.MaximumCheckoutTime" value="120000" />
            <property name="Pool.TimeToWait" value="500" />
            <property name="Pool.PingQuery" value="select 1 from ACCOUNT" />
            <property name="Pool.PingEnabled" value="false" />
            <property name="Pool.PingConnectionsOlderThan" value="1" />
            <property name="Pool.PingConnectionsNotUsedFor" value="1" />
        </dataSource>
    </transactionManager>

     ...

</sqlMapConfig>

Can someone help me?
Thanks in advance.
André

Mime
View raw message