Connecting to Oracle Database using JDBC OCI driver
This article discusses how to establish connections to an Oracle database using JDBC OCI (Type II). Please take into consideration that the proposed way uses DBeaver's Generic driver. It means that you cannot get Oracle-specific functionality this way.
JDBC OCI connections require Oracle Instant Client on the local machine. Please pay attention to the Instant Client and the JDBC driver versions, as they must be identical. DBeaver uses the 220.127.116.11 version by default at the moment, so we recommend using the 18.104.22.168 version of the Instant Client.
Extract or mount the Instant Client package as per your operating system and place the files in a selected folder. We will refer to this folder as ORA_HOME for the rest of the article.
ORA_HOME to the PATH variable and restart DBeaver before proceeding.
- If you do not have a
tnsnames.orafile, create one by following these steps:
- Open a text editor.
- Add your Oracle database connection details, which typically include the network alias, a description of the
connection, and address parameters such as hostname and port number. For example:
MYDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.example.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mydbservice.example.com) ) )
- Save the file as
- If you do not have a
Place the newly created or existing
tnsnames.orafile in the
Configuring driver in DBeaver
- In DBeaver, go to Window -> Driver Manager -> New to open the Create new driver dialog.
- In the Settings tab:
- Assign a Driver name as preferred.
- Set Class Name to
jdbc:oracle:oci:@tnsAliasas the URL Template, where tnsAlias is an alias from your
- Ensure the Driver Type is Generic.
Adding maven artifacts in DBeaver
- Under the Libraries tab, click Add Artifact.
- Insert the below XML in the text field.
<dependency> <groupId>com.oracle.database.jdbc</groupId> <artifactId>ojdbc8</artifactId> <version>22.214.171.124</version> </dependency> <dependency> <groupId>com.oracle.database.nls</groupId> <artifactId>orai18n</artifactId> <version>126.96.36.199</version> </dependency> <dependency> <groupId>com.oracle.database.xml</groupId> <artifactId>xdb6</artifactId> <version>188.8.131.52</version> </dependency> <dependency> <groupId>com.oracle.database.xml</groupId> <artifactId>xmlparserv2</artifactId> <version>184.108.40.206</version> </dependency>
Note: Replace the versions of the artifacts if you use a different version of the Instant Client.
Configuring driver properties
- Go to the Driver properties tab.
- Right-click and choose Add new property.
- Set the property name to
- Set the Value to
Once you have configured the properties, close the Driver Manager.
Create a new connection in DBeaver using the driver you have just configured.