[size=x-large][color=blue]
程序片段
DataSource ds = null;
try {
Context context = new InitialContext();
ds = (DataSource) context.lookup("java:/comp/env/jdbc/mysqlds");
} catch (Exception e) {
System.out.println("获取数据源时出错");
}
int result = 0;
try {
String sql = "insert into blog (name,age,height,time) values (?,?,?,now())";
String params[] = { name,age,height};
QueryRunner qr = new QueryRunner(ds);
result = qr.update(sql, params); // query()
} catch (SQLException e) {
e.printStackTrace();
}
commons dbutils 1.3 包已经引入
数据源连接没有问题
数据库连接没有问题
一用这个组件就报如下错误
java.lang.NoClassDefFoundError: org/apache/commons/dbutils/QueryRunner [/color][/size]