# 开发数据库地址
#jdbcUrl = jdbc:oracle:thin:@localhost:1521:testsa
jdbcUrl = jdbc:srdbsql://127.0.0.1:1975/srdb
db.default.driver=org.srdbsql.Driver
db.default.url= jdbc:srdbsql://127.0.0.1:1975/srdb
上面是project.txt中的配置。
重点:
db.default.driver=org.srdbsql.Driver
在代码中:
DruidPlugin druidPlugin = new DruidPlugin(getProperty("jdbcUrl"), getProperty("user"), getProperty("password"), getProperty("db.default.driver"));
druidPlugin.setValidationQuery("select 1 ");
druidPlugin.setTestOnBorrow(true);
//druidPlugin.setFilters("stat");
druidPlugin.addFilter(new StatFilter());
me.add(druidPlugin);
AutoTableBindPlugin arp = new AutoTableBindPlugin(druidPlugin, SimpleNameStyles.UP_UNDERLINE);
// arp.setDialect(new MysqlDialect()); //mysql的方言配置
arp.setDialect(new AnsiSqlDialect());
arp.setContainerFactory(new CaseInsensitiveContainerFactory());
arp.setShowSql(true); //输出sql语句
me.add(arp);
重点:
arp.setDialect(new AnsiSqlDialect());