The following code is a simple example of executing the SQL statements in Spring framework.
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
public class ExecuteAStatement {
private JdbcTemplate jt;
private DataSource dataSource;
public void executestmt() {
jt = new JdbcTemplate(dataSource);
jt.execute("create table person (id integer, name varchar(100))");
}
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
}