Java Code Examples for com.zaxxer.hikari.HikariDataSource#setDataSourceClassName()
The following examples show how to use
com.zaxxer.hikari.HikariDataSource#setDataSourceClassName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseConfig.java From NametagEdit with GNU General Public License v3.0 | 6 votes |
@Override public void load() { FileConfiguration config = handler.getConfig(); shutdown(); hikari = new HikariDataSource(); hikari.setMaximumPoolSize(config.getInt("MinimumPoolSize", 10)); hikari.setPoolName("NametagEdit Pool"); hikari.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); hikari.addDataSourceProperty("useSSL", false); hikari.addDataSourceProperty("requireSSL", false); hikari.addDataSourceProperty("verifyServerCertificate", false); hikari.addDataSourceProperty("serverName", config.getString("MySQL.Hostname")); hikari.addDataSourceProperty("port", config.getString("MySQL.Port")); hikari.addDataSourceProperty("databaseName", config.getString("MySQL.Database")); hikari.addDataSourceProperty("user", config.getString("MySQL.Username")); hikari.addDataSourceProperty("password", config.getString("MySQL.Password")); new DatabaseUpdater(handler, hikari, plugin).runTaskAsynchronously(plugin); }
Example 2
Source File: DynamicTenantAwareRoutingSource.java From SpringBootMultiTenancy with MIT License | 5 votes |
private HikariDataSource buildDataSource(DatabaseConfiguration configuration) { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName(configuration.getDataSourceClassName()); dataSource.addDataSourceProperty("url", configuration.getUrl()); dataSource.addDataSourceProperty("user", configuration.getUser()); dataSource.addDataSourceProperty("password", configuration.getPassword()); return dataSource; }
Example 3
Source File: SampleSpringApplication.java From SpringBootMultiTenancy with MIT License | 5 votes |
public DataSource tenantOne() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource"); dataSource.addDataSourceProperty("url", "jdbc:postgresql://127.0.0.1:5432/sampledb"); dataSource.addDataSourceProperty("user", "philipp"); dataSource.addDataSourceProperty("password", "test_pwd"); return dataSource; }
Example 4
Source File: SampleSpringApplication.java From SpringBootMultiTenancy with MIT License | 5 votes |
public DataSource tenantTwo() { HikariDataSource dataSource = new HikariDataSource(); dataSource.setInitializationFailTimeout(0); dataSource.setMaximumPoolSize(5); dataSource.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource"); dataSource.addDataSourceProperty("url", "jdbc:postgresql://127.0.0.1:5432/sampledb2"); dataSource.addDataSourceProperty("user", "philipp"); dataSource.addDataSourceProperty("password", "test_pwd"); return dataSource; }
Example 5
Source File: DatabaseConfig.java From spring-security-jwt-rest-stateless with MIT License | 5 votes |
@Bean public HikariDataSource getDataSource(){ HikariDataSource dataSource = new HikariDataSource(); dataSource.setDataSourceClassName("com.mysql.jdbc.jdbc2.optional.MysqlDataSource"); dataSource.addDataSourceProperty("databaseName", "demorest"); dataSource.addDataSourceProperty("portNumber", "3306"); dataSource.addDataSourceProperty("serverName", "127.0.0.1"); dataSource.addDataSourceProperty("user", "root"); dataSource.addDataSourceProperty("password", ""); return dataSource; }
Example 6
Source File: HikariCpJDK7IT.java From pinpoint with Apache License 2.0 | 5 votes |
@Test public void defaultTest3() throws InterruptedException, SQLException, NoSuchMethodException { HikariDataSource dataSource = new HikariDataSource(); dataSource.setDataSourceClassName(DATA_SOURCE_CLASS_NAME); dataSource.addDataSourceProperty("url", JDBC_URL); try { Connection connection = dataSource.getConnection("", ""); Assert.assertNotNull(connection); Thread.sleep(500); connection.close(); Thread.sleep(500); PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); verifier.printCache(); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.HikariDataSource.HikariDataSource()")); verifier.verifyTrace(event(serviceType, getConnectionMethod2, annotation(AnnotationKey.ARGS0.getName(), ""))); verifier.verifyTrace(event(serviceType, proxyConnectionMethod)); } finally { if (dataSource != null) { dataSource.close(); } } }
Example 7
Source File: HikariCpIT.java From pinpoint with Apache License 2.0 | 5 votes |
@Test public void defaultTest2() throws InterruptedException, SQLException { HikariDataSource dataSource = new HikariDataSource(); dataSource.setDataSourceClassName(DATA_SOURCE_CLASS_NAME); dataSource.addDataSourceProperty("url", JDBC_URL); try { Connection connection = dataSource.getConnection(); Assert.assertNotNull(connection); Thread.sleep(500); connection.close(); Thread.sleep(500); PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); verifier.printCache(); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.HikariDataSource.HikariDataSource()")); verifier.verifyTrace(event(serviceType, getConnectionMethod1)); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.pool.BaseHikariPool.BaseHikariPool(com.zaxxer.hikari.HikariConfig, java.lang.String, java.lang.String)")); verifier.verifyTrace(event(serviceType, proxyConnectionMethod)); } finally { if (dataSource != null) { dataSource.close(); } } }
Example 8
Source File: HikariCpIT.java From pinpoint with Apache License 2.0 | 5 votes |
@Test public void defaultTest3() throws InterruptedException, SQLException { HikariDataSource dataSource = new HikariDataSource(); dataSource.setDataSourceClassName(DATA_SOURCE_CLASS_NAME); dataSource.addDataSourceProperty("url", JDBC_URL); try { Connection connection = dataSource.getConnection("", ""); Assert.assertNotNull(connection); Thread.sleep(500); connection.close(); Thread.sleep(500); PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); verifier.printCache(); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.HikariDataSource.HikariDataSource()")); verifier.verifyTrace(event(serviceType, getConnectionMethod2, annotation(AnnotationKey.ARGS0.getName(), ""))); verifier.verifyTrace(event(serviceType, proxyConnectionMethod)); } finally { if (dataSource != null) { dataSource.close(); } } }
Example 9
Source File: HikariCpJDK7IT.java From pinpoint with Apache License 2.0 | 4 votes |
@Test public void defaultTest2() throws InterruptedException, SQLException, NoSuchMethodException { HikariDataSource dataSource = new HikariDataSource(); dataSource.setDataSourceClassName(DATA_SOURCE_CLASS_NAME); dataSource.addDataSourceProperty("url", JDBC_URL); try { Connection connection = dataSource.getConnection(); Assert.assertNotNull(connection); Thread.sleep(500); connection.close(); Thread.sleep(500); PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance(); verifier.printCache(); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.HikariDataSource.HikariDataSource()")); verifier.verifyTrace(event(serviceType, getConnectionMethod1)); verifier.verifyTrace(event(serviceType, "com.zaxxer.hikari.pool.BaseHikariPool.BaseHikariPool(com.zaxxer.hikari.HikariConfig, java.lang.String, java.lang.String)")); verifier.verifyTrace(event(serviceType, proxyConnectionMethod)); } finally { if (dataSource != null) { dataSource.close(); } } }