Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Apache Commons Pool and Commons DBCP #1017

Closed
Tracked by #1120
tfr42 opened this issue Nov 22, 2019 · 4 comments · Fixed by #1337
Closed
Tracked by #1120

Upgrade Apache Commons Pool and Commons DBCP #1017

tfr42 opened this issue Nov 22, 2019 · 4 comments · Fixed by #1337
Labels
enhancement enhancement or improvement

Comments

@tfr42
Copy link
Member

tfr42 commented Nov 22, 2019

Current versions are outdated and not maintained by the community anymore.
Upgrade to commons pool 2 and DBCP 2 is required. The commons-dbcp2 package relies on code in the commons-pool2 package.
see https://commons.apache.org/proper/commons-dbcp/index.html

@tfr42 tfr42 added enhancement enhancement or improvement in progress labels Nov 22, 2019
@tfr42
Copy link
Member Author

tfr42 commented Nov 22, 2019

It requires every JDBC connection configuration to be updated from org.apache.commons.dbcp.BasicDataSource to org.apache.commons.dbcp2.BasicDataSource.

@tfr42
Copy link
Member Author

tfr42 commented Nov 22, 2019

Without doing this change the user will see an error "Initialization of resource 'ps_blob_ds' failed: Unable to build resource ConnectionProviderProvider:ps_blob_ds: org.apache.commons.dbcp.BasicDataSource".

tfr42 added a commit to lat-lon/deegree3 that referenced this issue Nov 25, 2019
@tfr42
Copy link
Member Author

tfr42 commented Nov 25, 2019

A configuration using DBCP2 looks like this:

<?xml version='1.0' encoding='UTF-8'?>
<DataSourceConnectionProvider configVersion="3.4.0"
                              xmlns="http://www.deegree.org/connectionprovider/datasource"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:schemaLocation="http://www.deegree.org/connectionprovider/datasource http://schemas.deegree.org/jdbc/datasource/3.4.0/datasource.xsd">

    <!-- Creation / lookup of javax.sql.DataSource instance -->
    <DataSource javaClass="org.apache.commons.dbcp2.BasicDataSource"/>

    <!-- Configuration of DataSource properties -->
    <Property name="driverClassName" value="org.postgresql.Driver"/>
    <Property name="url" value="jdbc:postgresql://db:5432/ps_canonical"/>
    <Property name="username" value="deegree"/>
    <Property name="password" value="deegree"/>
    <Property name="initialSize" value="0"/>
    <Property name="maxTotal" value="10"/>
    <Property name="maxIdle" value="10"/>
    <Property name="maxWait" value="5000"/>
    <Property name="timeBetweenEvictionRunsMillis" value="5000"/> 
    <Property name="testOnBorrow" value="true"/>
    <Property name="testWhileIdle" value="true"/>
    <Property name="removeAbandonedOnBorrow" value="true"/>
    <Property name="removeAbandonedOnMaintenance" value="true"/> 
    <Property name="validationQuery" value="select version(), PostGIS_full_version()"/>
    <Property name="accessToUnderlyingConnectionAllowed" value="true"/>  
  
    <!-- for debugging -->
    <Property name="abandonedUsageTracking" value="true"/>
    <Property name="logAbandoned" value="true"/>
    <Property name="logExpiredConnections" value="true"/>

</DataSourceConnectionProvider>

@tfr42
Copy link
Member Author

tfr42 commented Nov 25, 2019

The configuration parameter are explained here: https://commons.apache.org/proper/commons-dbcp/configuration.html

stephanr added a commit to gritGmbH/deegree3 that referenced this issue May 14, 2022
…ommons DBCP 2.7.0

# Conflicts:
#	deegree-core/deegree-connectionprovider-datasource/src/main/resources/META-INF/schemas/connectionprovider/datasource/3.4.0/example_dbcp_mssql.xml
#	deegree-core/deegree-connectionprovider-datasource/src/main/resources/META-INF/schemas/connectionprovider/datasource/3.4.0/example_dbcp_oracle.xml
#	deegree-core/deegree-connectionprovider-datasource/src/main/resources/META-INF/schemas/connectionprovider/datasource/3.4.0/example_dbcp_postgres.xml
#	deegree-core/deegree-core-commons/pom.xml
@tfr42 tfr42 removed the in progress label May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement enhancement or improvement
Projects
None yet
1 participant