Using Oracle Wallet with Liquibase

Last updated: March 24, 2026

Oracle Wallet is a secure credential store that allows Liquibase to connect to Oracle Database without embedding usernames or passwords in configuration files. The Oracle JDBC Thin driver automatically resolves credentials from the wallet using a TNS alias. Your folder structure will look like this:

Oracle wallet folder structure

Before you begin

  • Install Liquibase

  • Ensure Java is installed. If you used the Liquibase Installer, Java is included automatically.

  • Install Oracle Client Tools (included with Oracle Database, Oracle Instant Client, or Oracle Database Client) to obtain the mkstore and orapki utilities used in this procedure.

  • Obtain connection details from your Oracle DBA: hostname, port, service name, username, and password.

Procedure

1

Download Oracle JDBC drivers

You need 4 JAR files to enable Oracle Wallet support. Choose your preferred method:

  1. Go to the Oracle JDBC Downloads page.

  2. Download the appropriate JDBC driver for your Oracle version.

  3. Extract and copy these files to your Liquibase lib/ directory:

    • ojdbc8.jar (or ojdbc11.jar for Oracle 21c+)

    • oraclepki.jar

    • osdt_core.jar

    • osdt_cert.jar

loading

loading
2

Create your wallet folder structure

Create the directory structure for your wallet and JAR files.

loading
3

Create Oracle Wallet

Set the following environment variables.

Be sure to:

  • Replace your_oracle_home with the path to your Oracle Client installation. For example, /opt/oracle/product/21c/dbhomeXE, /usr/lib/oracle/19c/client64, /opt/instantclient_21_1

loading

Create the wallet. When prompted, enter and confirm a wallet password.

mkstore -wrl $WALLET_DIR -create

Add your database credentials to the wallet, where your_tns_alias matches the TNS alias you will define in tnsnames.ora. Be sure to:

  • Replace your_tns_alias with your TNS alias. This must match the alias you define in tnsnames.ora. For example, MY_DB, PROD_DB, DEV_DB

  • Replace your_username with your database username. For example, myuser, system, admin

  • Replace your_password with your database password.

mkstore -wrl $WALLET_DIR -createCredential your_tns_alias your_username your_password

Verify the credential was stored.

mkstore -wrl $WALLET_DIR -listCredential
4

Create tnsnames.ora

Create tnsnames.ora in your wallet directory.

Be sure to:

  • Replace your_tns_alias with your TNS alias. This must match the alias used in the mkstore command. For example, MY_DB, PROD_DB, DEV_DB

  • Replace your_hostname with your hostname. For example, localhost, mydb.example.com, 192.168.1.100

  • Replace your_port with your port. Usually. For example, 1521

  • Replace your_service_name with your service name. For example, XEPDB1, ORCL, PROD

loading
5

Create sqlnet.ora

Create sqlnet.ora in your wallet directory to point the JDBC driver to your wallet.

Be sure to:

  • Replace your_wallet_dir with your absolute path to your wallet directory. For example, /home/user/oracle-wallet/wallet, /Users/name/oracle-wallet/wallet

loading
6

Configure JDBC properties

Create ojdbc.properties in your wallet directory.

Be sure to:

  • Replace your_wallet_dir with your absolute path to your wallet directory. For example, /home/user/oracle-wallet/wallet, /Users/name/oracle-wallet/wallet

oracle.net.wallet_location=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=your_wallet_dir)))
7

Configure Liquibase

Create or update liquibase.properties in your project directory. The URL uses /@your_tns_alias. You don't need a username or password,

Be sure to:

  • Replace your_tns_alias with your TNS alias from tnsnames.ora. For example, MY_DB, PROD_DB, DEV_DB

  • Replace your_lib_path/ in the classpath with the absolute path to your JAR files. You must include all 4 JAR files for wallet support. For example, /home/user/oracle-wallet/lib/, /Users/name/oracle-wallet/lib/

loading
8

Set environment variables

Set the following environment variables before running Liquibase.

loading

To make these permanent, add them to your shell profile.

loading
9

Test your setup

Verify that all required files are in place.

loading

Test the connection with Liquibase. Be sure to navigate to your Liquibase project.

liquibase validate

If validation passes, check the changelog status:

liquibase status

A successful connection returns the number of pending changesets (or confirms the changelog is up to date).