Hi All,
I want all records of file should be committed at once i.e commit-interval not useful for me.
To commit at last manually, i have turned off autoCommit(i.e false) of DataSource as well as Database
Here is dataSource configuration.
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${batch.jdbc.driver}" />
<property name="url" value="${batch.jdbc.url}" />
<property name="username" value="${batch.jdbc.user}" />
<property name="password" value="${batch.jdbc.password}" />
<property name="defaultAutoCommit"><value>false</value></property>
</bean>
In my writer, i am calling store procedure which insert items one by one. But when i look into database tables, all items are inserted i.e committed.
1. my database auto-commit property is false. so store proc is not committing data.
2. Log show dataSource autoCommit=false before calling store proc. but log shows transaction is committed.
3.commit-interval=100, items to inserts are 12.
4. tried to change dataSource to SingleConnectionDataSource but still commit happens.
5.In Spring Framework, i tried same scenario
- Turn off autoCommit=false of datasource as well as database autocommit property
- insert data into table
- When i check database, found item is not inserted into table.
But spring Batch step commit data after write method.
Can anybody help me as i have tried all options but Spring batch transactions are getting committed even though data source auto-commit=false.
Thanks
Tushar


Reply With Quote