validation query

public static void mySQLConfigPlugin(Plugins me) {
// C3p0Plugin dbplugin = createC3p0Plugin();
DruidPlugin dbplugin = createDruidPlugin();
/**
* hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS";
* Oracle - "select 1 from dual";
* DB2 - "select 1 from sysibm.sysdummy1";
* mysql - "select 1";//default
*/
dbplugin.setValidationQuery("select 1 ");// mysql
me.add(dbplugin);


// config ActiveRecord plugin
ActiveRecordPlugin arp = new ActiveRecordPlugin(dbplugin);
arp.setShowSql(PropKit.use("jdbc.properties").getBoolean("devMode", false)); //print sql 
arp.setContainerFactory(new CaseInsensitiveContainerFactory(true));//ignore case sensitive
arp.setDialect(new MysqlDialect());// mysql dialect
me.add(arp);


// _MappingKit.mapping(arp);
}


public static void oracleConfigPlugin(Plugins me) {
// C3p0Plugin dbplugin = createC3p0Plugin();
DruidPlugin dbplugin = createDruidPlugin();
/**
* hsqldb - "select 1 from INFORMATION_SCHEMA.SYSTEM_USERS";
* Oracle - "select 1 from dual";
* DB2 - "select 1 from sysibm.sysdummy1";
* mysql - "select 1";//default
*/
dbplugin.setValidationQuery("select 1 from dual");// oracle needed
me.add(dbplugin);


ActiveRecordPlugin arp = new ActiveRecordPlugin(dbplugin);
arp.setShowSql(PropKit.use("jdbc.properties").getBoolean("devMode", false)); //print sql
arp.setContainerFactory(new CaseInsensitiveContainerFactory(true));// ignore case sensitive
arp.setDialect(new OracleDialect());// oracle dialect
me.add(arp);
// _MappingKit.mapping(arp);
}

你可能感兴趣的:(mysql)