JfinalConfig.class /** * 配置插件 */ @Override public void configPlugin(Plugins me) { //sqlserver DruidPlugin dsSqlServer= new DruidPlugin(getProperty("jdbcUrl3"), getProperty("username3"), getProperty("password3").trim()); dsSqlServer.setDriverClass("com.microsoft.sqlserver.jdbc.SQLServerDriver"); me.add(dsSqlServer); ActiveRecordPlugin arpSqlServer = new ActiveRecordPlugin("sqls",dsSqlServer); arpSqlServer.setDialect(new SqlServerDialect()); me.add(arpSqlServer); //postgre DruidPlugin dsPost = new DruidPlugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password")); dsPost.setDriverClass("org.postgresql.Driver"); me.add(dsPost); ActiveRecordPlugin arpPost = new ActiveRecordPlugin("post",dsPost); arpPost.setDialect(new PostgreSqlDialect()); me.add(arpPost); } ---------------------------- 执行类方法 Object count = Db.use("sqls").query("select count(1) from "+tablename); System.out.println("count "+count); List<Record> list =Db.use("sqls").find("select top "+num+" * from "+tablename ); System.out.println(list.size()); Db.use("post").batchSave(tablename, list, num);
报错如下:
单步调试结果:(用的确实是postgre数据库的方言,但是编译之后不支持插入)