How to Create an Oracle Wallet for Applications to Use
How to Create an Oracle Wallet for Applications to Use
Introduction
In modern enterprise environments, security is not optional it is mandatory. Applications frequently need to connect to Oracle databases using credentials, certificates, or secure communication channels. Hardcoding usernames and passwords inside application code or configuration files is a major security risk.
This is where Oracle Wallet plays a crucial role.
An Oracle Wallet is a secure container used to store authentication credentials, SSL certificates, encryption keys, and database passwords. It allows applications to connect to Oracle databases without exposing sensitive credentials.
In this blog, we will cover:
- What Oracle Wallet is
- Why applications need Oracle Wallet
- Types of Oracle Wallets
- Step-by-step process to create an Oracle Wallet
- How applications use Oracle Wallet
- Common issues and best practices
Why Applications Need Oracle Wallet
Applications often face the following security challenges:
- Hardcoded database passwords
- Password exposure in config files
- Difficulty rotating passwords
- Non-compliance with security standards
Benefits of Using Oracle Wallet
- No hardcoded credentials
- Centralized credential management
- Easy password rotation without code changes
- Strong encryption for stored secrets
- Supports SSL/TLS for secure connections
- Required for Autonomous Database and TCPS connections
Types of Oracle Wallets
1. Password-Based Wallet
- Protected by a wallet password
- Must be opened manually
- Suitable for interactive environments
2. Auto Login Wallet (cwallet.sso)
- No password required at runtime
- Automatically opens when accessed
- Recommended for application usage
Most applications use Auto Login Wallets.
Prerequisites
Before creating an Oracle Wallet, ensure:
- Oracle Client or Database software is installed
- ORACLE_HOME is set correctly
mkstoreutility is available- OS user has permissions on wallet directory
Step 1: Create Wallet Directory
On Linux / Unix
mkdir -p /u01/app/wallets/app_wallet
chmod 700 /u01/app/wallets/app_wallet
On Windows
mkdir C:\oracle\wallets\app_wallet
🔐 Tip: Wallet directory should be owned by the application or Oracle user.
Step 2: Create the Oracle Wallet
Use the mkstore utility.
Linux / Unix
mkstore -wrl /u01/app/wallets/app_wallet -create
Windows
mkstore -wrl C:\oracle\wallets\app_wallet -create
You will be prompted to set a wallet password.
Wallet files created:
ewallet.p12
Step 3: Create Auto Login Wallet (Recommended)
Auto login wallet allows applications to access the wallet without a password.
Linux
mkstore -wrl /u01/app/wallets/app_wallet -createALogin
Windows
mkstore -wrl C:\oracle\wallets\app_wallet -createALogin
This creates:
cwallet.sso
Step 4: Add Database Credentials to Wallet
Syntax
mkstore -wrl <wallet_location> -createCredential <db_connect_string> <username> <password>
Example (Linux)
mkstore -wrl /u01/app/wallets/app_wallet \
-createCredential orclpdb app_user Welcome@123
Example (Windows)
mkstore -wrl C:\oracle\wallets\app_wallet -createCredential orclpdb app_user Welcome@123
Step 5: Verify Wallet Contents
mkstore -wrl /u01/app/wallets/app_wallet -listCredential
Output example:
List credential (index: connect_string username)
1: orclpdb app_user
Step 6: Configure sqlnet.ora
Applications and Oracle clients must know the wallet location.
Edit $ORACLE_HOME/network/admin/sqlnet.ora
WALLET_LOCATION =
(SOURCE =
(METHOD = FILE)
(METHOD_DATA =
(DIRECTORY = /u01/app/wallets/app_wallet)
)
)
SQLNET.WALLET_OVERRIDE = TRUE
🔹
SQLNET.WALLET_OVERRIDE = TRUEensures wallet credentials override login prompts.
Step 7: Application Connection Using Wallet
Using SQL*Plus (No Password)
sqlplus /@orclpdb
JDBC Connection Example
String url = "jdbc:oracle:thin:@orclpdb";
Properties props = new Properties();
props.put("oracle.net.wallet_location", "/u01/app/wallets/app_wallet");
Connection conn = DriverManager.getConnection(url, props);
TNS Entry Example (tnsnames.ora)
ORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbhost)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = orclpdb)
)
)
Common Use Cases for Oracle Wallet
- Secure application-to-database connectivity
- SSL/TLS database connections (TCPS)
- Oracle Autonomous Database
- Database links without passwords
- REST API authentication
- OCI services integration
Common Errors and Troubleshooting
ORA-01017: Invalid username/password
- Check wallet credentials
- Verify connect string
ORA-28759: Failed to open file
- Check wallet directory permissions
- Verify wallet path in sqlnet.ora
ORA-29024: Certificate validation failure
- Ensure correct SSL certificates
- Verify wallet contains trusted certs
Best Practices
- Always use Auto Login Wallet for applications
- Restrict wallet directory permissions
- Never commit wallet files to source control
- Rotate passwords using
mkstorewithout code changes - Backup wallet securely
Conclusion
Oracle Wallet is a critical security component for modern applications connecting to Oracle databases. It removes the risk of exposed credentials, simplifies password management, and supports enterprise-grade security standards.
By following the steps in this guide, you can confidently create and manage an Oracle Wallet that applications can securely use — without ever hardcoding a password again.
Want More Oracle DBA & Security Content?
Follow Learnomate Technologies for real-world Oracle DBA tutorials, interview prep, and production-ready guides shared by industry experts.
Happy Securing!
Want to see how we teach?
Head over to our YouTube channel for insights, tutorials, and tech breakdowns: www.youtube.com/@learnomate
To know more about our courses, offerings, and team:
Visit our official website: www.learnomate.org
Interested in mastering Oracle Database Administration?
Check out our comprehensive Oracle DBA Training program here:https://learnomate.org/oracle-dba-training/
Want to explore more tech topics?
Check out our detailed blog posts here: https://learnomate.org/blogs/
And hey, I’d love to stay connected with you personally!
Let’s connect on LinkedIn: Ankush Thavali
Happy learning!
Ankush😎