Connect Liquibase to Oracle Database using Oracle Internet Directory

Last updated: March 24, 2026

Oracle Internet Directory (OID) is an LDAP-based directory service that centralizes TNS name resolution. When configured, Liquibase resolves database service names through LDAP instead of a local tnsnames.ora file. This requires an active OID server with the target service published in the directory.

Note: You can combine OID-based name resolution with Oracle Wallet credential storage. See Using Oracle Wallet with Liquibase to store credentials in a wallet rather than in liquibase.properties.

Before you begin

  • Install Liquibase

  • Ensure Java is installed.

  • Obtain the following from your Oracle DBA: OID server hostname, LDAP port (typically 389 for non-SSL, 636 for SSL), and the default admin context (e.g., dc=company,dc=com).

Procedure

1

Download Oracle JDBC driver

All JARs are available from the Oracle JDBC Downloads page and Maven Central. Replace 21.13.0.0 with the latest 21.x release.

Download the following JARs from the Oracle JDBC Downloads page and place them in your lib/ directory.

  • ojdbc11.jar — required

  • oraclepki.jar, osdt_core.jar, osdt_cert.jar — optional, required only when using Oracle Wallet alongside OID

loading

loading
2

Configure ldap.ora

Create an Oracle Net administration directory (for example, ~/tns-admin) and add ldap.ora to point to your OID server.

Be sure to:

  • Replace your_admin_context with your LDAP admin context. For example, dc=company,dc=com, dc=myorg,dc=local

  • Replace your_oid_host with your OID server hostname. For example, oid.company.com, ldap.myorg.local

  • Replace your_ldap_port with your LDAP port. Usually, 389

  • Replace your_ldap_ssl_port with your LDAP SSL port. Usually, 636

loading
3

Configure sqlnet.ora

Create sqlnet.ora in the same directory to set LDAP as the primary name resolution method.

loading
4

Configure JDBC properties

Create ojdbc.properties pointing to your TNS admin directory.

Be sure to:

  • Replace your_tns_admin_dir with your absolute path to your TNS admin directory. For example, /home/user/tns-admin, /Users/name/tns-admin

loading
5

Configure Liquibase

Create liquibase.properties in your working directory. Option A is the standard setup using a TNS alias resolved through OID. Options B and C are inline alternatives for when TNS_ADMIN cannot be set. Option D uses Oracle Wallet for credentials (no username or password in the file).

Be sure to:

  • Replace your_tns_alias with the service name published in OID. For example, MYSERVICE, ORCL

  • Replace your_username with your database username (Options A, B, C only)

  • Replace your_password with your database password (Options A, B, C only)

  • Replace your_oid_host with your OID server hostname (Options B and C only). For example, oid.company.com

  • Replace your_ldap_port with your LDAP port (Option B only). Usually, 389

  • Replace your_ldap_ssl_port with your LDAPS port (Option C only). Usually, 636

  • Replace your_admin_context with your LDAP admin context (Options B and C only). For example, dc=company,dc=com

  • Replace your_wallet_dir with the absolute path to your Oracle Wallet directory (Option D only). For example, /home/user/oracle-wallet

loading
6

Set environment variables

Set the following environment variables before running Liquibase.

loading
7

Register your Oracle service in OID (DBA task)

Your DBA or directory admin must create an LDAP entry in OID for each Oracle service that Liquibase should connect to. Create a file named service.ldif with the following content.

Be sure to:

  • Replace MYSERVICE with your Oracle service name

  • Replace dc=company,dc=com with your LDAP admin context

  • Replace db.company.com with your Oracle DB hostname

loading

For SSL (TCPS), replace the orclNetDescString with:

loading

Load the LDIF file with ldapadd.

Be sure to:

  • Replace oid.company.com with your OID server hostname

  • Replace cn=orcladmin,dc=company,dc=com with your LDAP admin DN

  • Replace your_admin_password with your LDAP admin password

loading
8

Run Liquibase

Run Liquibase against your OID-configured database. The inline option at the end lets you run without a liquibase.properties file.

Be sure to:

  • Replace your_oid_host with your OID server hostname (inline option only)

  • Replace your_ldap_port with your LDAP port (inline option only). Usually, 389

  • Replace your_tns_alias with your service name (inline option only)

  • Replace your_admin_context with your LDAP admin context (inline option only). For example, dc=company,dc=com

  • Replace your_username and your_password with your database credentials (inline option only)

loading