Tuesday, November 14, 2006

Spring JDBC connection

Download Spring.jar version 2.0

- configure the xml
- DriverManagerDataSource class help you to configuration and get the connection from database
- DataSourceTransactionManager class that help to create the transaction when you want to insert or update the database.
- Create your own Dao Class, it just like a class represent a table but i do not help you to maintain the Has-a relationship.

In my sample project (you can import to Eclipse)
App.java - contain main method to execute (but i am connecting SQL Server... you can teach the concert)
OrderDao - interface class to represent what method contain in OrderDaoImpl
OrderDaoImpl - contain code to process
Order - Order represent the table Orders in Database
OrderRowMap - It help you to mapping value from resultset to create the object instance

It contain the method call "public Object mapRow(ResultSet rs, int index)" from the name you know it for mapping.