ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From terranceraphael <terrance_raph...@yahoo.com>
Subject using different datasource type for same datasource
Date Fri, 07 Nov 2008 17:45:03 GMT

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!
-- 
View this message in context: http://www.nabble.com/using-different-datasource-type-for-same-datasource-tp20385498p20385498.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message