You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by terranceraphael <te...@yahoo.com> on 2008/12/03 18:20:18 UTC

Re: using different datasource type for same datasource


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.