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
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— 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 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_aliaswith the service name published in OID. For example,MYSERVICE,ORCLReplace
your_usernamewith your database username (Options A, B, C only)Replace
your_passwordwith your database password (Options A, B, C only)Replace
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
your_admin_contextwith your LDAP admin context (Options B and C only). For example,dc=company,dc=comReplace
your_wallet_dirwith the absolute path to your Oracle Wallet directory (Option D only). For example,/home/user/oracle-wallet
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)