public DriverConnectionFactory(Driver driver, BaseJdbcConfig config) { this(driver, config.getConnectionUrl(), basicConnectionProperties(config)); }
private static ConnectionFactory connectionFactory(BaseJdbcConfig config, MySqlConfig mySqlConfig) throws SQLException { Properties connectionProperties = basicConnectionProperties(config); connectionProperties.setProperty("useInformationSchema", "true"); connectionProperties.setProperty("nullCatalogMeansCurrent", "false"); connectionProperties.setProperty("useUnicode", "true"); connectionProperties.setProperty("characterEncoding", "utf8"); connectionProperties.setProperty("tinyInt1isBit", "false"); if (mySqlConfig.isAutoReconnect()) { connectionProperties.setProperty("autoReconnect", String.valueOf(mySqlConfig.isAutoReconnect())); connectionProperties.setProperty("maxReconnects", String.valueOf(mySqlConfig.getMaxReconnects())); } if (mySqlConfig.getConnectionTimeout() != null) { connectionProperties.setProperty("connectTimeout", String.valueOf(mySqlConfig.getConnectionTimeout().toMillis())); } return new DriverConnectionFactory(new Driver(), config.getConnectionUrl(), connectionProperties); }
private static ConnectionFactory connectionFactory(BaseJdbcConfig config, MySqlConfig mySqlConfig) throws SQLException { Properties connectionProperties = basicConnectionProperties(config); connectionProperties.setProperty("useInformationSchema", "true"); connectionProperties.setProperty("nullCatalogMeansCurrent", "false"); connectionProperties.setProperty("useUnicode", "true"); connectionProperties.setProperty("characterEncoding", "utf8"); connectionProperties.setProperty("tinyInt1isBit", "false"); if (mySqlConfig.isAutoReconnect()) { connectionProperties.setProperty("autoReconnect", String.valueOf(mySqlConfig.isAutoReconnect())); connectionProperties.setProperty("maxReconnects", String.valueOf(mySqlConfig.getMaxReconnects())); } if (mySqlConfig.getConnectionTimeout() != null) { connectionProperties.setProperty("connectTimeout", String.valueOf(mySqlConfig.getConnectionTimeout().toMillis())); } return new DriverConnectionFactory(new Driver(), config.getConnectionUrl(), connectionProperties); }