怎样单独使用JFinal的activeRecord进行数据库操作
1个回答
推荐于2016-11-18
展开全部
public static void main(String[] args) throws Exception {
C3p0Plugin c3p0Plugin = new C3p0Plugin(
"jdbc:oracle:thin:@192.168.1.89:1521:orcl", "test", "test");
c3p0Plugin.setDriverClass("oracle.jdbc.driver.OracleDriver");
Record record = new Record();
record.set("id", "111111");
Db.save(c3p0Plugin.getDataSource(), "tb_test", record);
}
比如这段代码,运行有报错.
Exception in thread "main" com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.NullPointerException
at com.jfinal.plugin.activerecord.Db.save(Db.java:655)
at com.jfinal.plugin.activerecord.Db.save(Db.java:665)
at com.hzjrd.writerDb.JFinalTest.main(JFinalTest.java:20)
Caused by: java.lang.NullPointerException
at com.jfinal.plugin.activerecord.Db.save(Db.java:652)
C3p0Plugin c3p0Plugin = new C3p0Plugin(
"jdbc:oracle:thin:@192.168.1.89:1521:orcl", "test", "test");
c3p0Plugin.setDriverClass("oracle.jdbc.driver.OracleDriver");
Record record = new Record();
record.set("id", "111111");
Db.save(c3p0Plugin.getDataSource(), "tb_test", record);
}
比如这段代码,运行有报错.
Exception in thread "main" com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.NullPointerException
at com.jfinal.plugin.activerecord.Db.save(Db.java:655)
at com.jfinal.plugin.activerecord.Db.save(Db.java:665)
at com.hzjrd.writerDb.JFinalTest.main(JFinalTest.java:20)
Caused by: java.lang.NullPointerException
at com.jfinal.plugin.activerecord.Db.save(Db.java:652)
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询