Deployment package JDBC drivers
Overview
Including multiple JDBC drivers in a deployment package can be useful in certain situations. For example, supporting both MySQL and PostgreSQL during a migration project, or when MySQL is used in development and Oracle in production.
note
This approach might not work well for different versions of the same database driver since their class names will likely be the same. This could cause a clash at runtime, leading to unexpected behaviour and errors.
Approach
Project teams can activate Maven profiles to indicate which JDBC drivers should be included in the deployment package. When the deployment package is built, those drivers will be copied into both the ext-datapopulation-cli
tool and the database/jdbc
folder of the deployment package archive.
These binaries are then available for deployment as needed. By default, the commerce application docker images copy all JAR files from the deployment package database/jdbc
folder to the appropriate folder in Tomcat to make that available to Elastic Path Commerce services.
Detailed Steps
To exclude the implicit development-time driver, deactivate its profile in your Maven build command line:
-P-include-dev-jdbc-driver
To include specific drivers, add the profiles you need to your Maven build command line:
-Pinclude-oracle-jdbc-driver
-Pinclude-postgresql-jdbc-driver
-Pinclude-mysql-jdbc-driver
note
Setting the property -Pinclude-all-jdbc-drivers
will include all explicitly defined drivers, and will deactivate the implicit development JDBC driver.
note
If you want to permanently change to use the explicitly defined drivers you can change the setting of activeByDefault
for the driver profiles you want active. These Maven profiles can be found in extensions/database/ext-jdbc-drivers/pom.xml
.