Executing DDL statements :-
Executing an SQL statement requires very little code. You need a DataSource and
a JdbcTemplate, including the convenience methods that are provided with the
JdbcTemplate.
We can use the execute(..) method from jdbcTemplate to execute any SQL
statements or DDL statements. Following is an example to use CREATE statement to
create a table:
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
public class ExecuteStatement {
private JdbcTemplate jt;
public void setDataSource(DataSource ds) {
this.jt = new JdbcTemplate(ds);}
public void Execute() {
this.jt.execute("create table Employee (id integer, name varchar(20),salary integer)");
}}