1. Create a java project(SpringJDBC).
  2. Add spring jar files to the project build path.
  3. Create a package under src directory called(com.java2learn.springjdbc).
  4. Create a Employee POJO class
  5. Create a EmployeeDAO interface
  6. Create a EmployeeDAOImpl class implements EmployeeDAO interfaces.
  7. Create a spring-beans.xml file to confiure beans.
  8. Create a Test client to execute the program.

Create a java project(SpringJDBC)

create java project

Add spring jar files to the project build path (Download Spring-Jdbc-JARS)

spring jar files

Create a package under src directory called(com.java2learn.springjdbc) and add the following classes under com.java2learn.springjdbc package.

Create Employee POJO class

package com.java2learn.springjdbc;

public class Employee {

	private int empNo;
	private String empName;
	private String empAddress;
	public int getEmpNo() {
		return empNo;
	public void setEmpNo(int empNo) {
		this.empNo = empNo;
	public String getEmpName() {
		return empName;
	public void setEmpName(String empName) {
		this.empName = empName;
	public String getEmpAddress() {
		return empAddress;
	public void setEmpAddress(String empAddress) {
		this.empAddress = empAddress;

Create EmployeeDAO interface

package com.java2learn.springjdbc;
public interface EmployeeDAO {
    void insertEmployee(Employee employee);

Create EmployeeDAOImpl class

package com.java2learn.springjdbc;

import org.springframework.jdbc.core.JdbcTemplate;

public class EmployeeDAOImpl implements EmployeeDAO {

	private JdbcTemplate jdbcTemplate;

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;

	public void insertEmployee(Employee employee) {

		String sql = "insert into employee values(?,?,?)";
				new Object[] { employee.getEmpNo(), employee.getEmpName(),
						employee.getEmpAddress() });