Oracle JDBC Maven installation¶
To use the Oracle JDBC driver in a project, it is often necessary to install the JAR file manually into the local Maven repository, as it may not be available in public repositories due to licensing restrictions.^[600-developer__database__oracle__oracle-record.md]
This process is executed using the mvn install:install-file command, which requires specifying the location of the JAR file and its Maven coordinates (Group ID, Artifact ID, Version, and Packaging).^[600-developer__database__oracle__oracle-record.md]
Installation Command¶
The following command demonstrates how to install the ojdbc7 driver (version 12.1.0.2) from a local file path:
mvn install:install-file \
-Dfile=C:/soft/git/git.pf2/pf2/lib/ojdbc7-12.1.0.2.jar \
-DgroupId=com.oracle \
-DartifactId=ojdbc7 \
-Dversion=12.1.0.2 \
-Dpackaging=jar
Parameters¶
-Dfile: The absolute path to the JAR file on the local filesystem.-DgroupId: The Group ID under which the artifact should be stored (e.g.,com.oracle).-DartifactId: The Artifact ID, typically the name of the JAR file (e.g.,ojdbc7).-Dversion: The version string of the library (e.g.,12.1.0.2).-Dpackaging: The type of packaging, which isjarfor JDBC drivers.
Once installed, the dependency can be referenced in the project's pom.xml using the coordinates provided during the installation.
Related¶
- Maven
- [[JDBC]]
- [[Oracle Database]]
Sources¶
^[600-developer__database__oracle__oracle-record.md]