Oracle JDBC OCI connections
This article explains how to connect to an Oracle database using JDBC OCI (Type II). This method uses DBeaver's Generic driver by default, and Oracle-specific functionality depends on selecting the Oracle driver type.
Info
For information on Oracle Thin driver connection methods, see Configure Oracle connections.
Prerequisites¶
JDBC OCI connections require Oracle Instant Client on your local machine. The Instant Client and JDBC driver versions must match. DBeaver currently uses version 12.2.0.1 by default, so use version 12.2.0.1 of the Instant Client.
Extract or mount the Instant Client package for your operating system, and place the files in a folder of your choice. This article refers to that folder as ORA_HOME.
Append ORA_HOME to the PATH variable and restart DBeaver before proceeding.
Configuration¶
-
Prepare a
tnsnames.orafile-
If you don't have a
tnsnames.orafile, create one:- Open a text editor.
-
Add your Oracle database connection details. These typically include the network alias, a connection description, and address parameters such as the hostname and port number.
-
Save the file as
tnsnames.ora.
-
-
Place the new or existing
tnsnames.orafile in theORA_HOME/network/admindirectory. -
Configure the driver in DBeaver:
- In DBeaver, go to Window -> Driver Manager -> New to open the Create new driver dialog.
-
On the Settings tab:
- Enter your preferred Driver name.
- Set Class Name to
oracle.jdbc.OracleDriver. - Set URL Template to
jdbc:oracle:oci:@tnsAlias, where tnsAlias is an alias from yourtnsnames.orafile. - Set Driver Type to Generic.
Tip
The Generic driver type is recommended for broader compatibility, but it isn't required. You can select the Oracle driver type to access Oracle-specific features. However, a non-generic driver might cause unexpected errors with some JDBC functionality.
-
Add Maven artifacts in DBeaver:
- On the Libraries tab, click Add Artifact.
- Paste the following XML into the text field.
<dependencies> <dependency> <groupId>com.oracle.database.jdbc</groupId> <artifactId>ojdbc8</artifactId> <version>12.2.0.1</version> </dependency> <dependency> <groupId>com.oracle.database.nls</groupId> <artifactId>orai18n</artifactId> <version>12.2.0.1</version> </dependency> <dependency> <groupId>com.oracle.database.xml</groupId> <artifactId>xdb6</artifactId> <version>12.2.0.1</version> </dependency> <dependency> <groupId>com.oracle.database.xml</groupId> <artifactId>xmlparserv2</artifactId> <version>12.2.0.1</version> </dependency> </dependencies>Note
Replace the artifact versions if you use a different version of the Instant Client.
-
Configure driver properties:
- Go to the Driver properties tab.
- Right-click and choose Add new property.
- Set the property name to
protocol(without quotes). - Set the Value to
oci(without quotes).
-
Close the Driver Manager after you configure the properties.
- Create a connection in DBeaver using the driver you configured.