ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From terranceraphael <terrance_raph...@yahoo.com>
Subject Re: using different datasource type for same datasource
Date Wed, 03 Dec 2008 17:20:18 GMT


terranceraphael wrote:
> 
> Hello,
> 
> Basically my app can run in web as well as batch mode. Web uses JNDI
> Datasource and Batch mode does not use any datasource.
> 
> Since all the sql-maps are one and the same for both the modes, I was
> wondering how I can avoid having two config files ( one for batch and
> other for web )
> 
> I am relying on iBatis DAO framework instead of Spring.
> 
> Here is how my current config is
> 
> sqlmap-config-batch.xml
> ------------------
> <sqlMapConfig>
> 
> 	<!--  Load Database credentials -->
> 	<properties resource="db.properties" />
> 
> 	<transactionManager type="JDBC">
> 		<dataSource type="SIMPLE">
> 			<property name="JDBC.Driver" value="${db.driver}" />
> 			<property name="JDBC.ConnectionURL" value="${db.url}" />
> 			<property name="JDBC.Username" value="${db.user}" />
> 			<property name="JDBC.Password" value="${db.password}" />
> 		</dataSource>
> 	</transactionManager>
> 
> 	<sqlMap resource="sql1.xml" />
> 	<sqlMap	resource="sql2.xml" />
> 
> </sqlMapConfig>
> 
> AND
> 
> sqlmap-config-web.xml
> ------------------
> <sqlMapConfig>
> 
> 	<transactionManager type="JDBC" commitRequired="true">
> 		<dataSource type="JNDI">
> 			<property name="DataSource" value="java:comp/env/jndiDBResource" />
> 		</dataSource>
> 	</transactionManager>
> 
> 	<sqlMap resource="sql1.xml" />
> 	<sqlMap	resource="sql2.xml" />
> 
> </sqlMapConfig>
> 
> Thanks!
> 

"My goal here is to avoid the duplication of <sqlMap ..> entries for
sql1.xml, sql2.xml ....."

-- 
View this message in context: http://www.nabble.com/using-different-datasource-type-for-same-datasource-tp20385498p20817399.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message