Simple application of spring in JDBCTemplate

cn.itcast.datasource.jdbctemplate Package ; 

Import cn.itcast.utils.JDBCUtils ;
Import org.springframework.jdbc.core.JdbcTemplate ;

Import the javax.sql.DataSource ;

/ **
* @author newcityman
* @date 2019 /. 8 / . 17 - 0:51
* Getting the JdbcTemplate
* /
public class JdbcTemplateDemo01 {
public static void main (String [] args) {
//. 1, introduced into the corresponding jar package
// 2, to create an object JDBCTemplate
the JdbcTemplate Template = new new the JdbcTemplate (JDBCUtils. getDataSource ( )) ;
// 3, call the method
String SQL = "Update the Account the SET Balance = the WHERE the above mentioned id =??" ;
template.update I = int (SQL , 8000 , . 4) ;
IF (I> 0) {
. the System Out.println ( "Data successfully modified") ;

} the else {
. the System Out.println ( "Data modification failure") ;
}
}
}

Guess you like

Origin www.cnblogs.com/newcityboy/p/11367109.html