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
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— requiredoraclepki.jar,osdt_core.jar,osdt_cert.jar— optional, required only when using Oracle Wallet alongside OID
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_contextwith your LDAP admin context. For example,dc=company,dc=com,dc=myorg,dc=localReplace
your_oid_hostwith your OID server hostname. For example,oid.company.com,ldap.myorg.localReplace
your_ldap_portwith your LDAP port. Usually,389Replace
your_ldap_ssl_portwith your LDAP SSL port. Usually,636
Configure sqlnet.ora
Create sqlnet.ora in the same directory to set LDAP as the primary name resolution method.
Configure JDBC properties
Create ojdbc.properties pointing to your TNS admin directory.
Be sure to:
Replace
your_tns_admin_dirwith your absolute path to your TNS admin directory. For example,/home/user/tns-admin,/Users/name/tns-admin
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_aliaswith the service name registered in OID. For example,MYSERVICE,ORCLReplace
your_usernamewith your database usernameReplace
your_passwordwith your database passwordReplace
your_oid_hostwith your OID server hostname (Options B and C only). For example,oid.company.comReplace
your_ldap_portwith your LDAP port (Option B only). Usually,389Replace
your_ldap_ssl_portwith your LDAPS port (Option C only). Usually,636Replace
dc=your_domain,dc=comwith your LDAP admin context (Options B and C only). For example,dc=company,dc=com
Set environment variables
Set the following environment variables before running Liquibase.
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
MYSERVICEwith your Oracle service nameReplace
dc=company,dc=comwith your LDAP admin contextReplace
db.company.comwith your Oracle DB hostname
For SSL (TCPS), replace the orclNetDescString with:
Load the LDIF file with ldapadd.
Be sure to:
Replace
oid.company.comwith your OID server hostnameReplace
cn=orcladmin,dc=company,dc=comwith your LDAP admin DNReplace
your_admin_passwordwith your LDAP admin password
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_hostwith your OID server hostname (inline option only)Replace
your_ldap_portwith your LDAP port (inline option only). Usually,389Replace
your_tns_aliaswith your service name (inline option only)Replace
your_admin_contextwith your LDAP admin context (inline option only). For example,dc=company,dc=comReplace
your_usernameandyour_passwordwith your database credentials (inline option only)