java项目,使用dbutils进行添加数据,在runner后面获取连接池报错...
发布网友
发布时间:2024-03-29 09:43
我来回答
共1个回答
热心网友
时间:2024-07-24 15:39
private static void update() throws SQLException{
QueryRunner runner = new QueryRunner();
Connection conn = DBManager.getConnection();
String sql = "UPDATE test SET xxx = ? WHERE xxx = ?";
Object [] params = new Object[]{"xxx", 111};
runner.update(conn, sql, params);
}
private static void insert() throws SQLException{
QueryRunner runner = new QueryRunner();
Connection conn = DBManager.getConnection();
String sql = "INSERT INTO xxx";
Object [] params = new Object[]{xxx,xxx};
runner.update(conn, sql, params);
}
参考这样写