code to set driver class name, database URL, username and password For example: SimpleDriverDataSource dataSource = new SimpleDriverDataSource() To use JdbcTemplate, we must inject a DataSource reference either via constructor or setter when instantiating a new JdbcTemplate object. Working with JDBC in Spring (JdbcTemplate)Spring framework simplifies JDBC development through the use of JdbcTemplate class which helps programmers to avoid common errors, reduce boilerplate code to focus on writing SQL queries and extracting result set. Of course the code example will work with newer versions of Spring, JDBC and MySQL database. The sample project is built using Eclipse Kepler and Maven 3.0. The example code is tested with Spring JDBC 4.0.3 and MySQL database server 5.5.23 using MySQL Connector Java 5.1.30 library. In this Spring tutorial, we discuss how to access relational database using JDBC with Spring framework.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |