JDBCTemplate的小练习 关于DQL的一般性方法
import com.alibaba.druid.pool.DruidDataSourceFactory;
import org.junit.Test;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Date;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import java.util.Properties;
public class templateTest {
@Test
public void test01() throws Exception {
Properties p = new Properties();
InputStream resourceAsStream = templateTest.class.getClassLoader().getResourceAsStream("druid.properties");
p.load(resourceAsStream);
DataSource dataSource = DruidDataSourceFactory.createDataSource(p);
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
String sql = "update emp set salary = 10000 where id =1";
int update = jdbcTemplate.update(sql);
System.out.println(update);
}
@Test
public void test02() throws Exception {
Properties p = new