mysql

BeanFactory applicationContext = new ClassPathXmlApplicationContext("bean.xml");
dataSource = (DataSource)applicationContext.getBean("dataSource");
try{
Connection conn = dataSource.getConnection();
conn.createStatement().executeUpdate("insert into user1(name,passwd)values('"+u.getName()+"','"+u.getPhone()+"')");
conn.close();
}catch (SQLException e){
e.printStackTrace();
}

posted @ 2012-11-08 16:11  SA高处不胜寒  阅读(158)  评论(0编辑  收藏  举报