Introducing Agent Safe Governance for the AI Era

Connect Liquibase to Oracle Database using Oracle Internet Directory

Last updated: July 9, 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

If you are connecting using an inline LDAP URL (for example, jdbc:oracle:thin:@ldap://your_oid_host:port/...), skip to Step 4: Configure Liquibase. Steps 1–3 are only required if you are connecting using a TNS alias.

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

To connect using a TNS alias (Option A), you must also install Oracle Instant Client 23c. It provides the OCI native libraries (for example, ocijdbc23.dll on Windows) that the jdbc:oracle:oci driver requires. Earlier versions such as 19c will not work. The inline LDAP URL options (B and C) use the thin driver and do not need Instant Client.

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 enterprise setup. Liquibase resolves the TNS alias through OID at connect time using the Oracle OCI driver (which requires Oracle Instant Client 23c), so you never hard-code OID server details in your properties file. Options B and C use the thin driver, embed the OID server address directly in the URL, and do not require ldap.ora or sqlnet.ora. To use Oracle Wallet for credentials, see Using Oracle Wallet with Liquibase.

Be sure to:

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

  • Replace your_username with your database username

  • Replace your_password with your database password

  • 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 dc=your_domain,dc=com with your LDAP admin context (Options B and C only). For example, dc=company,dc=com

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