Java Reference
In-Depth Information
Because you added the MySQL driver to the POM file, let's configure the connection to the database
next. As covered in Chapter 2, you configure the database connection both for the JobRepository and the
application's database in the statement/src/main/resources/ file. Listing 10-3 shows
the contents of this file configured for the statement job.
Listing 10-3.
# Values to connect to my local
# use this one for a separate server process so you can inspect the results
# (or add it to system properties with -D to override at run time).
# batch.jdbc.url=jdbc:hsqldb:hsql://localhost:9005/samples
The values in the file are those required in launch-context.xml :
batch.jdbc.driver : The fully qualified class name of the JDBC driver for the
database you're using. Here, you use MySQL's driver: com.mysql.jdbc.Driver.
batch.jdbc.url : The URL to the database you're connecting to for your
JobRepository. For the example application, you use one database schema for all
batch.jdbc.user : The username for the database you're connecting to.
batch.jdbc.password : The password for the database.
batch.schema : In MySQL's case, the database you're using.
The last piece of the project setup is to update the launch-context.xml file to prune the beans that
you don't need for this job and update the XSDs to use Spring 3 instead of Spring 2.5 (which they come
configured to use). Listing 10-4 shows the updated statement/src/main/resources/launch-context.xml
Listing 10-4. launch-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
<bean id="jobExplorer"
p:dataSource-ref="dataSource" />
Search WWH ::

Custom Search