Simple Spring JDBC Template

David Winterfeldt

2008


A simple example using SimpleJdbcTemplate.

1. Spring Configuration

The Spring JDBC Template just needs a DataSource. The jdbc:embedded-database element automatically initializes an HSQL DB DataSource with the schema.sql script.

                
<jdbc:embedded-database id="dataSource" type="HSQL">
    <jdbc:script location="classpath:/schema.sql" />
</jdbc:embedded-database>