1 driver=net.sourceforge.jtds.jdbc.Driver 2 jdbcUrl = jdbc:sqlserver://localhost:1433;DatabaseName=test 3 user =SA 4 password =123456 5 devMode = true
上面是连接sqlserver配置文件
在dbconfig里面的代码如下:
1 // 配置C3p0数据库连接池插件 2 C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password").trim(),getProperty("driver")); 3 me.add(c3p0Plugin); 4 5 // 配置ActiveRecord插件 6 ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin); 7 me.add(arp); 8 arp.setDialect(new AnsiSqlDialect()); //此处是重点,不然会出错 9 arp.addMapping("blog", Blog.class);
时间: 2024-10-11 18:17:15