Spring Batch database config for PostGreSQL

Spring Batch uses a database to keep track of its tasks’ state etc. The default DB of choice is HSQL but I use PostGreSQL so I decided to tweak the settings in batch.properties to taste. It took me a few minutes to get everything up and working, mostly by googling around. Here are my settings for the benefit of all.

#make sure that "my_springbatch_db" (or whatever you chose to call it) exists
batch.jdbc.url=jdbc:postgresql://localhost/my_springbatch_db
batch.jdbc.driver=org.postgresql.Driver
batch.jdbc.user=replace_this_with_username
batch.jdbc.password=replace_this_with_password
batch.jdbc.testWhileIdle=false
batch.jdbc.validationQuery=
batch.drop.script=/org/springframework/batch/core/schema-drop-postgresql.sql
batch.schema.script=/org/springframework/batch/core/schema-postgresql.sql
batch.business.schema.script=business-schema-postgresql.sql
batch.data.source.init=true
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
batch.database.incrementer.parent=sequenceIncrementerParent
batch.grid.size=2
batch.verify.cursor.position=true

Advertisements

One Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s