Spring Integrated JDBC

Source: Internet
Author: User

Process Analysis


three ways of doing


JDBC Programming features


Static code + dynamic variable = JDBC programming. In spring , dynamic variables can be given in the form of injections. This way of programming is suitable for packaging into templates. Static code forms a template, while a dynamic variable is a parameter that needs to be passed in.



Introduction of DataSource


inject DataSource in spring



<beanclass= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" ><property name= " Locations "><value>classpath:jdbc.properties</value></property></bean><bean id=" DataSource "destroy-method=" Close "class=" Org.apache.commons.dbcp.BasicDataSource "><property name=" Driverclassname "value=" ${jdbc.driverclassname} "/><property name=" url "value=" ${jdbc.url} "/><property Name= "username" value= "${jdbc.username}"/><property name= "password" value= "${jdbc.password}"/></bean >



use of RowMapper


cause: In Jdbc Operations, there are many cases where the data in the ResultSet is encapsulated in a persisted Bean and then persisted the Bean is encapsulated into the collection. This can cause a lot of duplication of code and is not conducive to code reuse. and rowmapper just solved the problem.

the RowMapper process

How to use



Spring Consolidated JDBC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.