diff --git a/.mvn/maven.config b/.mvn/maven.config index 4efb4fe4..778240bf 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -1 +1 @@ --Drevision=3.1.0 +-Drevision=3.1.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index ca5d6582..4d4b7965 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ Types of changes: ## [Unreleased] +## [3.1.1] - 2024-05-23 + +### Fixed + +- [Wrong JDBC setup for Flyway in release 3.1.0.](https://github.com/paulissoft/oracle-tools/issues/159) + ## [3.1.0] - 2024-05-14 ### Added diff --git a/conf/app/pom.xml b/conf/app/pom.xml index be34afd2..b1120503 100644 --- a/conf/app/pom.xml +++ b/conf/app/pom.xml @@ -22,15 +22,6 @@ ${env.DB_PASSWORD} - - - - ${ojdbc.groupId} - ${ojdbc.artifactId} - ${ojdbc.version} - - - test-connection diff --git a/conf/pom.xml b/conf/pom.xml index e0830c65..8934e7f0 100644 --- a/conf/pom.xml +++ b/conf/pom.xml @@ -111,23 +111,8 @@ ${ojdbc.groupId} ${ojdbc.artifactId} ${ojdbc.version} - pom + ${ojdbc.type} - @@ -135,7 +120,7 @@ ${ojdbc.groupId} ${ojdbc.artifactId} - pom + ${ojdbc.type} diff --git a/jdbc/pom.xml b/jdbc/pom.xml index 99988f3a..f66702a6 100644 --- a/jdbc/pom.xml +++ b/jdbc/pom.xml @@ -36,9 +36,6 @@ 3.3.1 3.4.2 1.18.30 - ${ojdbc.artifactId} - ucp${ojdbc.java.version} - ${ojdbc.version} 5.2.3.RELEASE 2.2.3.RELEASE 3.9 @@ -68,16 +65,6 @@ ${lombok.version} provided - - ${ojdbc.groupId} - ${oracle.ojdbc.artifactId} - ${oracle.jdbc.version} - - - ${ojdbc.groupId} - ${oracle.ucp.artifactId} - ${oracle.jdbc.version} - org.springframework @@ -161,14 +148,12 @@ lombok provided + ${ojdbc.groupId} - ${oracle.ojdbc.artifactId} - provided - - - ${ojdbc.groupId} - ${oracle.ucp.artifactId} + ${ojdbc.artifactId} + ${ojdbc.version} + ${ojdbc.type} provided @@ -270,18 +255,6 @@ versions:display-dependency-updates versions:display-parent-updates versions:display-plugin-updates versions:display-property-updates - - java8 - - false - - - 8 - ojdbc8 - ucp - 19.7.0.0 - - diff --git a/jdbc/smart-pool-data-source-jmh-test/pom.xml b/jdbc/smart-pool-data-source-jmh-test/pom.xml index 5ab63a8b..cb8ad360 100644 --- a/jdbc/smart-pool-data-source-jmh-test/pom.xml +++ b/jdbc/smart-pool-data-source-jmh-test/pom.xml @@ -70,9 +70,6 @@ THE POSSIBILITY OF SUCH DAMAGE. 2.2.3.RELEASE 3.4.2 1.18.30 - ojdbc11 - ucp11 - 23.3.0.23.09 @@ -107,18 +104,6 @@ THE POSSIBILITY OF SUCH DAMAGE. ${lombok.version} provided - - com.oracle.database.jdbc - ${oracle.ojdbc.artifactId} - ${oracle.jdbc.version} - test - - - com.oracle.database.jdbc - ${oracle.ucp.artifactId} - ${oracle.jdbc.version} - test - com.paulissoft.pato.jdbc smart-pool-data-source diff --git a/jdbc/smart-pool-data-source-jmh/pom.xml b/jdbc/smart-pool-data-source-jmh/pom.xml index 5edbeee6..0f50d997 100644 --- a/jdbc/smart-pool-data-source-jmh/pom.xml +++ b/jdbc/smart-pool-data-source-jmh/pom.xml @@ -96,16 +96,6 @@ lombok ${lombok.version} provided - - - com.oracle.database.jdbc - ${oracle.ojdbc.artifactId} - ${oracle.jdbc.version} - - - com.oracle.database.jdbc - ${oracle.ucp.artifactId} - ${oracle.jdbc.version} com.paulissoft.pato.jdbc diff --git a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceHikari.java b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceHikari.java index 8aee8a61..43774049 100644 --- a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceHikari.java +++ b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceHikari.java @@ -3,6 +3,8 @@ import com.zaxxer.hikari.HikariConfig; import java.sql.Connection; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; import lombok.NonNull; import lombok.experimental.Delegate; import lombok.extern.slf4j.Slf4j; @@ -295,22 +297,29 @@ private void updatePoolDescription(@NonNull final PoolDataSourceConfigurationHik poolDataSource.getPoolName(), poolDataSource); - final String suffix = "-" + getPoolDataSourceConfiguration().getSchema(); + final ArrayList items = new ArrayList(Arrays.asList(poolDataSource.getPoolName().split("-"))); + final String schema = getPoolDataSourceConfiguration().getSchema(); + + log.debug("items: {}; schema: {}", items, schema); - // set pool name if (initializing) { - if (poolDataSource.getPoolName() == null || - !poolDataSource.getPoolName().startsWith(getPoolNamePrefix() + "-")) { - poolDataSource.setPoolName(getPoolNamePrefix() + suffix); - } else if (!isParentPoolDataSource) { - poolDataSource.setPoolName(poolDataSource.getPoolName() + suffix); + if (isParentPoolDataSource) { + items.clear(); + items.add(getPoolNamePrefix()); + items.add(schema); + } else if (!isParentPoolDataSource && !items.contains(schema)) { + items.add(schema); } - } else if (!isParentPoolDataSource) { - poolDataSource.setPoolName(poolDataSource.getPoolName().replace(suffix, "")); + } else if (!isParentPoolDataSource && items.contains(schema)) { + items.remove(schema); + } + + if (items.size() >= 2) { + poolDataSource.setPoolName(String.join("-", items)); } - // keep poolDataSourceConfiguration in sync - poolDataSourceConfiguration.setPoolName(poolDataSource.getPoolName()); + // keep poolDataSource.getPoolName() and poolDataSourceConfiguration.getPoolName() in sync + poolDataSourceConfiguration.setPoolName(getPoolNamePrefix() + "-" + schema); // own prefix } finally { log.debug("config pool data source; name: {}; address: {}", poolDataSourceConfiguration.getPoolName(), diff --git a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceOracle.java b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceOracle.java index 461d389f..4ee7a294 100644 --- a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceOracle.java +++ b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/CombiPoolDataSourceOracle.java @@ -2,6 +2,8 @@ import java.sql.Connection; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; import lombok.NonNull; import lombok.experimental.Delegate; import lombok.extern.slf4j.Slf4j; @@ -179,11 +181,21 @@ public String getPoolNamePrefix() { return this.getClass().getSimpleName(); } + // IMPORTANT + // + // Since the connection pool name can notchange once the pool has started, + // we change the description if we add/remove schemas. public String getPoolDescription() { - final SimplePoolDataSourceOracle poolDataSource = getPoolDataSource(); - final String description = poolDataSource.getDescription(); + return getPoolDescription(getPoolDataSource()); + } - return poolDataSource.getConnectionPoolName() + description != null ? description : ""; + private static String getPoolDescription(@NonNull final SimplePoolDataSourceOracle poolDataSource) { + final String poolName = poolDataSource.getConnectionPoolName(); + final String description = poolDataSource.getDescription(); + + return (poolName == null || poolName.isEmpty() ? + "" : + poolName + (description == null || description.isEmpty() ? "" : "-" + description)); } @Override @@ -200,23 +212,43 @@ protected void updatePoolDescription(@NonNull final PoolDataSourceConfigurationO poolDataSource.getConnectionPoolName(), poolDataSource); - // set pool name - final String suffix = "-" + getPoolDataSourceConfiguration().getSchema(); + // IMPORTANT + // + // Since the connection pool name can notchange once the pool has started, + // we change the description if we add/remove schemas. + final String poolDescription = getPoolDescription(poolDataSource); + final ArrayList items = new ArrayList(Arrays.asList(poolDescription.split("-"))); // use pool description not just name + // final String schema = getPoolDataSourceConfiguration().getSchema(); + final String schema = poolDataSourceConfiguration.getSchema(); + + log.debug("items: {}; schema: {}", items, schema); + if (initializing) { - if (poolDataSource.getConnectionPoolName() == null || - !poolDataSource.getConnectionPoolName().startsWith(getPoolNamePrefix() + "-")) { - poolDataSource.setConnectionPoolName(getPoolNamePrefix() + suffix); + if (isParentPoolDataSource) { + items.clear(); + items.add(getPoolNamePrefix()); + items.add(schema); + } else if (!isParentPoolDataSource && !items.contains(schema)) { + items.add(schema); + } + } else if (!isParentPoolDataSource && items.contains(schema)) { + items.remove(schema); + } + + if (items.size() >= 2) { + poolDataSource.setConnectionPoolName(items.get(0) + "-" + items.get(1)); + items.remove(0); + items.remove(0); + if (items.size() >= 1) { + poolDataSource.setDescription(String.join("-", items)); + } else { poolDataSource.setDescription(""); - } else if (!isParentPoolDataSource) { - poolDataSource.setDescription(poolDataSource.getDescription() + suffix); } - } else if (!isParentPoolDataSource) { - poolDataSource.setDescription(poolDataSource.getDescription().replace(suffix, "")); } - // keep poolDataSource in sync with poolDataSourceConfiguration - poolDataSourceConfiguration.setConnectionPoolName(poolDataSource.getConnectionPoolName()); + // keep poolDataSource.getPoolDescription() and poolDataSourceConfiguration.getConnectionPoolName() in sync + poolDataSourceConfiguration.setConnectionPoolName(getPoolNamePrefix() + "-" + schema); // own prefix } catch (SQLException ex) { throw new RuntimeException(SimplePoolDataSource.exceptionToString(ex)); } finally { diff --git a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourcePropertiesGettersOracle.java b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourcePropertiesGettersOracle.java index 1b6e6887..ee8802e8 100644 --- a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourcePropertiesGettersOracle.java +++ b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourcePropertiesGettersOracle.java @@ -117,8 +117,6 @@ public interface PoolDataSourcePropertiesGettersOracle extends PoolDataSourcePro String getServiceName(); - int getSecondsToTrustIdleConnection(); - void reconfigureDataSource(Properties paramProperties) throws SQLException; int getMaxConnectionsPerService(); diff --git a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourceStatistics.java b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourceStatistics.java index 26c664af..810c961a 100644 --- a/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourceStatistics.java +++ b/jdbc/smart-pool-data-source/src/main/java/com/paulissoft/pato/jdbc/PoolDataSourceStatistics.java @@ -220,7 +220,7 @@ boolean isClosed() { boolean result = true; if (!isUpdateable.get()) { - result = false; + result = true; } else if (isClosedSupplier != null) { result = isClosedSupplier.get(); } else if (children != null) { @@ -233,6 +233,8 @@ boolean isClosed() { } } + logger.debug("isClosed(): {}", result); + return result; } @@ -416,7 +418,7 @@ private boolean mustShowTotals() { } public void close() throws Exception { - logger.debug(">close()"); + logger.info("{} - Close initiated...", getDescription()); try { if (isUpdateable.get()) { @@ -426,18 +428,19 @@ public void close() throws Exception { isUpdateable.set(false); } } finally { - logger.debug(" env) throws Exception { - final Object result = super.getObjectInstance(refObj, name, nameCtx, env); - log.trace("getObjectInstance(refObj, name, nameCtx, env) = {}", result); - return result; - } - - @Override - public java.util.logging.Logger getParentLogger() { - final java.util.logging.Logger result = super.getParentLogger(); - log.trace("getParentLogger() = {}", result); - return result; - } - - @Override - public Properties getPdbRoles() { - final Properties result = super.getPdbRoles(); - log.trace("getPdbRoles() = {}", result); + log.debug("getMaxPoolSize() = {}", result); return result; } @Override - public int getPortNumber() { - final int result = super.getPortNumber(); - log.trace("getPortNumber() = {}", result); - return result; + public void setMaxPoolSize(int maxPoolSize) throws SQLException { + log.debug("setMaxPoolSize({})", maxPoolSize); + super.setMaxPoolSize(maxPoolSize); } @Override - public int getPropertyCycle() { - final int result = super.getPropertyCycle(); - log.trace("getPropertyCycle() = {}", result); + public int getMaxStatements() { + final int result = super.getMaxStatements(); + log.debug("getMaxStatements() = {}", result); return result; } @Override - public int getQueryTimeout() { - final int result = super.getQueryTimeout(); - log.trace("getQueryTimeout() = {}", result); - return result; + public void setMaxStatements(int maxStatements) throws SQLException { + log.debug("setMaxStatements({})", maxStatements); + super.setMaxStatements(maxStatements); } @Override - public Reference getReference() { - final Reference result = super.getReference(); - log.trace("getReference() = {}", result); + public int getMinPoolSize() { + final int result = super.getMinPoolSize(); + log.debug("getMinPoolSize() = {}", result); return result; } @Override - public String getRoleName() { - final String result = super.getRoleName(); - log.trace("getRoleName() = {}", result); - return result; + public void setMinPoolSize(int minPoolSize) throws SQLException { + log.debug("setMinPoolSize({})", minPoolSize); + super.setMinPoolSize(minPoolSize); } @Override public int getSecondsToTrustIdleConnection() { final int result = super.getSecondsToTrustIdleConnection(); - log.trace("getSecondsToTrustIdleConnection() = {}", result); - return result; - } - - @Override - public String getServerName() { - final String result = super.getServerName(); - log.trace("getServerName() = {}", result); - return result; - } - - @Override - public String getServiceName() { - final String result = super.getServiceName(); - log.trace("getServiceName() = {}", result); - return result; - } - - @Override - public boolean getShardingMode() { - final boolean result = super.getShardingMode(); - log.trace("getShardingMode() = {}", result); - return result; - } - - @Override - public String getSQLForValidateConnection() { - final String result = super.getSQLForValidateConnection(); - log.trace("getSQLForValidateConnection() = {}", result); + log.debug("getSecondsToTrustIdleConnection() = {}", result); return result; } @Override - protected javax.net.ssl.SSLContext getSSLContext() { - final javax.net.ssl.SSLContext result = super.getSSLContext(); - log.trace("getSSLContext()"); - return result; + public void setSecondsToTrustIdleConnection(int secondsToTrustIdleConnection) throws SQLException { + log.debug("setSecondsToTrustIdleConnection({})", secondsToTrustIdleConnection); + super.setSecondsToTrustIdleConnection(secondsToTrustIdleConnection); } @Override - public JDBCConnectionPoolStatistics getStatistics() { - log.trace("getStatistics()"); - return super.getStatistics(); + public void setTimeoutCheckInterval(int timeInterval) throws SQLException { + log.debug("setTimeoutCheckInterval({})", timeInterval); + super.setTimeoutCheckInterval(timeInterval); } @Override public int getTimeoutCheckInterval() { - log.trace("getTimeoutCheckInterval()"); + log.debug("getTimeoutCheckInterval()"); return super.getTimeoutCheckInterval(); } @Override public int getTimeToLiveConnectionTimeout() { - log.trace("getTimeToLiveConnectionTimeout()"); + log.debug("getTimeToLiveConnectionTimeout()"); return super.getTimeToLiveConnectionTimeout(); } @Override - public String getURL() { - log.trace("getURL()"); - return super.getURL(); - } - - @Override - public String getUser() { - log.trace("getUser()"); - return super.getUser(); - } - - @Override - public boolean getValidateConnectionOnBorrow() { - log.trace("getValidateConnectionOnBorrow()"); - return super.getValidateConnectionOnBorrow(); - } - - @Override - public boolean isReadOnlyInstanceAllowed() { - final boolean result = super.isReadOnlyInstanceAllowed(); - log.trace("isReadOnlyInstanceAllowed() = {}", result); - return result; - } - - public static boolean isSetOnceProperty(String key) { - return PoolDataSourceImpl.isSetOnceProperty(key); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - final boolean result = super.isWrapperFor(iface); - log.trace("isWrapperFor(iface) = {}", result); - return result; - } - - @Override - public void reconfigureDataSource(Properties configuration) throws SQLException { - log.trace("reconfigureDataSource(configuration)"); - super.reconfigureDataSource(configuration); - } - - @Override - public void registerConnectionAffinityCallback(ConnectionAffinityCallback cbk) throws SQLException { - log.trace("registerConnectionAffinityCallback(cbk)"); - super.registerConnectionAffinityCallback(cbk); - } - - @Override - public void registerConnectionInitializationCallback(ConnectionInitializationCallback cbk) throws SQLException { - log.trace("registerConnectionInitializationCallback(cbk)"); - super.registerConnectionInitializationCallback(cbk); - } - - @Override - public void registerConnectionLabelingCallback(ConnectionLabelingCallback cbk) throws SQLException { - log.trace("registerConnectionLabelingCallback(cbk)"); - super.registerConnectionLabelingCallback(cbk); - } - - @Override - public void removeConnectionAffinityCallback() throws SQLException { - log.trace("removeConnectionAffinityCallback()"); - super.removeConnectionAffinityCallback(); - } - - @Override - public void removeConnectionLabelingCallback() throws SQLException { - log.trace("removeConnectionLabelingCallback()"); - super.removeConnectionLabelingCallback(); - } - - @Override - public void setAbandonedConnectionTimeout(int abandonedConnectionTimeout) throws SQLException { - log.trace("setAbandonedConnectionTimeout({})", abandonedConnectionTimeout); - super.setAbandonedConnectionTimeout(abandonedConnectionTimeout); - } - - @Override - public void setConnectionFactoryClassName(String factoryClassName) throws SQLException { - log.trace("setConnectionFactoryClassName({})", factoryClassName); - super.setConnectionFactoryClassName(factoryClassName); - } - - @Override - public void setConnectionFactoryProperties(Properties factoryProperties) throws SQLException { - log.trace("setConnectionFactoryProperties({})", factoryProperties); - super.setConnectionFactoryProperties(factoryProperties); - } - - @Override - public void setConnectionFactoryProperty(String name, String value) throws SQLException { - log.trace("setConnectionFactoryProperty({}, {})", name, value); - super.setConnectionFactoryProperty(name, value); - } - - @Override - public void setConnectionHarvestMaxCount(int connectionHarvestMaxCount) throws SQLException { - log.trace("setConnectionHarvestMaxCount({})", connectionHarvestMaxCount); - super.setConnectionHarvestMaxCount(connectionHarvestMaxCount); - } - - @Override - public void setConnectionHarvestTriggerCount(int connectionHarvestTriggerCount) throws SQLException { - log.trace("setConnectionHarvestTriggerCount({})", connectionHarvestTriggerCount); - super.setConnectionHarvestTriggerCount(connectionHarvestTriggerCount); - } - - @Override - public void setConnectionLabelingHighCost(int highCost) throws SQLException { - log.trace("setConnectionLabelingHighCost()", highCost); - super.setConnectionLabelingHighCost(highCost); - } - - @Override - public void setConnectionPoolName(String connectionPoolName) throws SQLException { - log.trace("setConnectionPoolName({})", connectionPoolName); - super.setConnectionPoolName(connectionPoolName); - } - - @Override - public void setConnectionProperties(Properties connectionProperties) throws SQLException { - log.trace("setConnectionProperties({})", connectionProperties); - super.setConnectionProperties(connectionProperties); - } - - @Override - public void setConnectionProperty(String name, String value) throws SQLException { - log.trace("setConnectionProperty({}, {})", name, value); - super.setConnectionProperty(name, value); - } - - @Override - public void setConnectionRepurposeThreshold(int threshold) throws SQLException { - log.trace("setConnectionRepurposeThreshold({})", threshold); - super.setConnectionRepurposeThreshold(threshold); - } - - @Override - public void setConnectionValidationTimeout(int connectionValidationTimeout) throws SQLException { - log.trace("setConnectionValidationTimeout({})", connectionValidationTimeout); - super.setConnectionValidationTimeout(connectionValidationTimeout); - } - - @Override - public void setConnectionWaitTimeout(int waitTimeout) throws SQLException { - log.trace("setConnectionWaitTimeout({})", waitTimeout); - super.setConnectionWaitTimeout(waitTimeout); - } - - @Override - public void setDatabaseName(String databaseName) throws SQLException { - log.trace("setDatabaseName({})", databaseName); - super.setDatabaseName(databaseName); - } - - @Override - public void setDataSourceName(String dataSourceName) throws SQLException { - log.trace("setDataSourceName({})", dataSourceName); - super.setDataSourceName(dataSourceName); - } - - @Override - public void setDescription(String dataSourceDescription) throws SQLException { - log.trace("setDescription({})", dataSourceDescription); - super.setDescription(dataSourceDescription); - } - - @Override - public void setFastConnectionFailoverEnabled(boolean failoverEnabled) throws SQLException { - log.trace("setFastConnectionFailoverEnabled({})", failoverEnabled); - super.setFastConnectionFailoverEnabled(failoverEnabled); - } - - @Override - public void setHighCostConnectionReuseThreshold(int threshold) throws SQLException { - log.trace("setHighCostConnectionReuseThreshold({})", threshold); - super.setHighCostConnectionReuseThreshold(threshold); - } - - @Override - public void setInactiveConnectionTimeout(int inactivityTimeout) throws SQLException { - log.trace("setInactiveConnectionTimeout({})", inactivityTimeout); - super.setInactiveConnectionTimeout(inactivityTimeout); - } - - @Override - public void setInitialPoolSize(int initialPoolSize) throws SQLException { - log.trace("setInitialPoolSize({})", initialPoolSize); - super.setInitialPoolSize(initialPoolSize); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - log.trace("setLoginTimeout({})", seconds); - super.setLoginTimeout(seconds); - } - - @Override - public void setLogWriter(PrintWriter logWriter) throws SQLException { - log.trace("setLogWriter({})", logWriter); - super.setLogWriter(logWriter); - } - - @Override - public void setMaxConnectionReuseCount(int maxConnectionReuseCount) throws SQLException { - log.trace("setMaxConnectionReuseCount({})", maxConnectionReuseCount); - super.setMaxConnectionReuseCount(maxConnectionReuseCount); - } - - @Override - public void setMaxConnectionReuseTime(long maxConnectionReuseTime) throws SQLException { - log.trace("setMaxConnectionReuseTime({})", maxConnectionReuseTime); - super.setMaxConnectionReuseTime(maxConnectionReuseTime); - } - - @Override - public void setMaxConnectionsPerShard(int maxConnectionsPerShard) throws SQLException { - log.trace("setMaxConnectionsPerShard({})", maxConnectionsPerShard); - super.setMaxConnectionsPerShard(maxConnectionsPerShard); - } - - @Override - public void setMaxIdleTime(int idleTime) throws SQLException { - log.trace("setMaxIdleTime({})", idleTime); - super.setMaxIdleTime(idleTime); - } - - @Override - public void setMaxPoolSize(int maxPoolSize) throws SQLException { - log.trace("setMaxPoolSize({})", maxPoolSize); - super.setMaxPoolSize(maxPoolSize); - } - - @Override - public void setMaxStatements(int maxStatements) throws SQLException { - log.trace("setMaxStatements({})", maxStatements); - super.setMaxStatements(maxStatements); - } - - @Override - public void setMinPoolSize(int minPoolSize) throws SQLException { - log.trace("setMinPoolSize({})", minPoolSize); - super.setMinPoolSize(minPoolSize); - } - - @Override - public void setNetworkProtocol(String networkProtocol) throws SQLException { - log.trace("setNetworkProtocol({})", networkProtocol); - super.setNetworkProtocol(networkProtocol); - } - - @Override - public void setONSConfiguration(String onsConfigStr) { - log.trace("setONSConfiguration({})", onsConfigStr); - super.setONSConfiguration(onsConfigStr); - } - - @Override - public void setPassword(String password) throws SQLException { - super.setPassword(password); - } - - @Override - public void setPortNumber(int portNumber) throws SQLException { - log.trace("setPortNumber({})", portNumber); - super.setPortNumber(portNumber); - } - - @Override - public void setPropertyCycle(int propertyCycle) throws SQLException { - log.trace("setPropertyCycle({})", propertyCycle); - super.setPropertyCycle(propertyCycle); - } - - @Override - public void setQueryTimeout(int queryTimeout) throws SQLException { - log.trace("setQueryTimeout({})", queryTimeout); - super.setQueryTimeout(queryTimeout); - } - - @Override - public void setReadOnlyInstanceAllowed(boolean readOnlyInstanceAllowed) throws SQLException { - log.trace("setReadOnlyInstanceAllowed({})", readOnlyInstanceAllowed); - super.setReadOnlyInstanceAllowed(readOnlyInstanceAllowed); - } - - @Override - public void setRoleName(String roleName) throws SQLException { - log.trace("setRoleName({})", roleName); - super.setRoleName(roleName); - } - - @Override - public void setSecondsToTrustIdleConnection(int secondsToTrustIdleConnection) throws SQLException { - log.trace("setSecondsToTrustIdleConnection({})", secondsToTrustIdleConnection); - super.setSecondsToTrustIdleConnection(secondsToTrustIdleConnection); - } - - @Override - public void setServerName(String serverName) throws SQLException { - log.trace("setServerName({})", serverName); - super.setServerName(serverName); - } - - @Override - public void setShardingMode(boolean shardingMode) throws SQLException { - log.trace("setShardingMode({})", shardingMode); - super.setShardingMode(shardingMode); - } - - @Override - public void setSQLForValidateConnection(String SQLString) throws SQLException { - log.trace("setSQLForValidateConnection({})", SQLString); - super.setSQLForValidateConnection(SQLString); - } - - @Override - public void setSSLContext(javax.net.ssl.SSLContext sslContext) { - log.trace("setSSLContext({})", sslContext); - super.setSSLContext(sslContext); + public void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) throws SQLException { + log.debug("setTimeToLiveConnectionTimeout({})", timeToLiveConnectionTimeout); + super.setTimeToLiveConnectionTimeout(timeToLiveConnectionTimeout); } @Override - public void setTimeoutCheckInterval(int timeInterval) throws SQLException { - log.trace("setTimeoutCheckInterval({})", timeInterval); - super.setTimeoutCheckInterval(timeInterval); + public String getURL() { + log.debug("getURL()"); + return super.getURL(); } @Override - public void setTimeToLiveConnectionTimeout(int timeToLiveConnectionTimeout) throws SQLException { - log.trace("setTimeToLiveConnectionTimeout({})", timeToLiveConnectionTimeout); - super.setTimeToLiveConnectionTimeout(timeToLiveConnectionTimeout); + public void setURL(String url) throws SQLException { + log.debug("setURL({})", url); + super.setURL(url); } @Override - public void setURL(String url) throws SQLException { - log.trace("setURL({})", url); - super.setURL(url); + public String getUser() { + log.debug("getUser()"); + return super.getUser(); } @Override public void setUser(String username) throws SQLException { - log.trace("setUser({})", username); + log.debug("setUser({})", username); super.setUser(username); } @Override - public void setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow) throws SQLException { - log.trace("setValidateConnectionOnBorrow({})", validateConnectionOnBorrow); - super.setValidateConnectionOnBorrow(validateConnectionOnBorrow); + public boolean getValidateConnectionOnBorrow() { + log.debug("getValidateConnectionOnBorrow()"); + return super.getValidateConnectionOnBorrow(); } - + @Override - public void startPool() throws SQLException { - log.trace("startPool({})", getConnectionPoolName()); - super.startPool(); + public void setValidateConnectionOnBorrow(boolean validateConnectionOnBorrow) throws SQLException { + log.debug("setValidateConnectionOnBorrow({})", validateConnectionOnBorrow); + super.setValidateConnectionOnBorrow(validateConnectionOnBorrow); } } diff --git a/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationHikariUnitTest.java b/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationHikariUnitTest.java index 43026554..4942fd87 100644 --- a/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationHikariUnitTest.java +++ b/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationHikariUnitTest.java @@ -47,8 +47,7 @@ void testPoolDataSourceConfigurationDomain() { assertEquals(CombiPoolDataSourceHikari.class, poolDataSourceConfiguration.getType()); assertEquals("PoolDataSourceConfigurationHikari(super=PoolDataSourceConfiguration(driverClassName=oracle.jdbc.OracleDriver, " + "url=jdbc:oracle:thin:@//127.0.0.1:1521/freepdb1, username=bodomain, password=bodomain, " + - "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceHikari), poolName=HikariPool-" + - (domainDataSourceHikari.isParentPoolDataSource() ? "bodomain" : "boopapij-bodomain") + ", " + + "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceHikari), poolName=HikariPool-bodomain, " + "maximumPoolSize=60, minimumIdle=60, dataSourceClassName=null, autoCommit=true, connectionTimeout=30000, " + "idleTimeout=600000, maxLifetime=1800000, connectionTestQuery=select 1 from dual, initializationFailTimeout=1, " + "isolateInternalQueries=false, allowPoolSuspension=false, readOnly=false, registerMbeans=false, " + @@ -69,8 +68,7 @@ void testPoolDataSourceConfigurationOperator() { assertEquals(CombiPoolDataSourceHikari.class, poolDataSourceConfiguration.getType()); assertEquals("PoolDataSourceConfigurationHikari(super=PoolDataSourceConfiguration(driverClassName=oracle.jdbc.OracleDriver, " + "url=jdbc:oracle:thin:@//127.0.0.1:1521/freepdb1, username=bodomain[boopapij], password=bodomain, " + - "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceHikari), poolName=HikariPool-" + - (operatorDataSourceHikari.isParentPoolDataSource() ? "boopapij" : "boopapij-bodomain") + ", " + + "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceHikari), poolName=HikariPool-boopapij, " + "maximumPoolSize=60, minimumIdle=60, dataSourceClassName=null, autoCommit=true, connectionTimeout=30000, " + "idleTimeout=600000, maxLifetime=1800000, connectionTestQuery=select 1 from dual, initializationFailTimeout=1, " + "isolateInternalQueries=false, allowPoolSuspension=false, readOnly=false, registerMbeans=false, " + @@ -85,7 +83,10 @@ void testPoolDataSource() { final SimplePoolDataSourceHikari simplePoolDataSourceHikari = domainDataSourceHikari.getPoolDataSource(); - assertEquals("HikariPool-boopapij-bodomain", simplePoolDataSourceHikari.getPoolName()); + assertEquals(domainDataSourceHikari.isParentPoolDataSource() ? + "HikariPool-bodomain-boopapij" : + "HikariPool-boopapij-bodomain", + simplePoolDataSourceHikari.getPoolName()); assertEquals(2 * 60, simplePoolDataSourceHikari.getMaximumPoolSize()); assertEquals(2 * 60, simplePoolDataSourceHikari.getMinimumIdle()); assertEquals(null, simplePoolDataSourceHikari.getDataSourceClassName()); diff --git a/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationOracleUnitTest.java b/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationOracleUnitTest.java index dbab0c64..11cd99ee 100644 --- a/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationOracleUnitTest.java +++ b/jdbc/smart-pool-data-source/src/test/java/com/paulissoft/pato/jdbc/CheckConfigurationOracleUnitTest.java @@ -48,8 +48,7 @@ void testPoolDataSourceConfigurationDomain() { assertEquals(CombiPoolDataSourceOracle.class, poolDataSourceConfiguration.getType()); assertEquals("PoolDataSourceConfigurationOracle(super=PoolDataSourceConfiguration(driverClassName=null, " + "url=jdbc:oracle:thin:@//127.0.0.1:1521/freepdb1, username=bodomain, password=bodomain, " + - "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceOracle), " + - "connectionPoolName=MyDomainDataSourceOracle-bodomain, " + + "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceOracle), connectionPoolName=MyDomainDataSourceOracle-bodomain, " + "initialPoolSize=0, minPoolSize=10, maxPoolSize=20, connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource, " + "validateConnectionOnBorrow=false, abandonedConnectionTimeout=120, timeToLiveConnectionTimeout=120, " + "inactiveConnectionTimeout=0, timeoutCheckInterval=30, maxStatements=10, connectionWaitTimeout=3, " + @@ -70,11 +69,7 @@ void testPoolDataSourceConfigurationOperator() { assertEquals(CombiPoolDataSourceOracle.class, poolDataSourceConfiguration.getType()); assertEquals("PoolDataSourceConfigurationOracle(super=PoolDataSourceConfiguration(driverClassName=null, " + "url=jdbc:oracle:thin:@//127.0.0.1:1521/freepdb1, username=bodomain[boopapij], password=bodomain, " + - "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceOracle), " + - "connectionPoolName=" + (operatorDataSourceOracle.isParentPoolDataSource() ? - operatorDataSourceOracle.getPoolNamePrefix() : - domainDataSourceOracle.getPoolNamePrefix()) + "-" + - (operatorDataSourceOracle.isParentPoolDataSource() ? "boopapij" : "bodomain") + ", " + + "type=class com.paulissoft.pato.jdbc.CombiPoolDataSourceOracle), connectionPoolName=MyOperatorDataSourceOracle-boopapij, " + "initialPoolSize=0, minPoolSize=10, maxPoolSize=20, connectionFactoryClassName=oracle.jdbc.pool.OracleDataSource, " + "validateConnectionOnBorrow=false, abandonedConnectionTimeout=120, timeToLiveConnectionTimeout=120, " + "inactiveConnectionTimeout=0, timeoutCheckInterval=30, maxStatements=10, connectionWaitTimeout=3, " + @@ -89,7 +84,9 @@ void testPoolDataSource() { final SimplePoolDataSourceOracle simplePoolDataSourceOracle = domainDataSourceOracle.getPoolDataSource(); - assertEquals(domainDataSourceOracle.getPoolNamePrefix() + "-bodomain", + assertEquals(domainDataSourceOracle.isParentPoolDataSource() ? + domainDataSourceOracle.getPoolNamePrefix() + "-bodomain" : + operatorDataSourceOracle.getPoolNamePrefix() + "-boopapij", simplePoolDataSourceOracle.getConnectionPoolName()); assertEquals(0, simplePoolDataSourceOracle.getInitialPoolSize()); assertEquals(2 * 10, simplePoolDataSourceOracle.getMinPoolSize()); diff --git a/jdbc/smart-pool-data-source/src/test/resources/application-test.properties b/jdbc/smart-pool-data-source/src/test/resources/application-test.properties index aa156f3b..8777221a 100644 --- a/jdbc/smart-pool-data-source/src/test/resources/application-test.properties +++ b/jdbc/smart-pool-data-source/src/test/resources/application-test.properties @@ -1,3 +1,16 @@ +## ======= +## logging +## ======= +## logging.level.org.hibernate.type=trace +#logging.level.root=INFO +#logging.level.com.paulissoft.pato.jdbc=DEBUG +#logging.level.com.paulissoft.pato.jdbc.SimplePoolDataSourceHikari=TRACE +#logging.level.com.paulissoft.pato.jdbc.SimplePoolDataSourceOracle=TRACE +# +## https://stackoverflow.com/questions/60757590/logging-hikaricp-spring-boot +#logging.level.com.zaxxer.hikari.HikariConfig=DEBUG +#logging.level.com.zaxxer.hikari=TRACE + # === # Database Config # === diff --git a/pom.xml b/pom.xml index b15e826e..415d1a73 100644 --- a/pom.xml +++ b/pom.xml @@ -65,15 +65,31 @@ - - 10.13.0 + + 10.12.0 com.oracle.database.jdbc 11 - ojdbc${ojdbc.java.version} + ojdbc${ojdbc.java.version}-production 23.3.0.23.09 + pom + + com.oracle.database.security + oraclepki + ${ojdbc.version} + + ${oraclepki.groupId} + osdt_core + 21.11.0.0 + + ${osdt_core.groupId} + osdt_cert + ${osdt_core.version} + + +