Establishing the connection between oracle and Katalon. Oracle installed in azure vm and katalon installed in remote windows server. how to integrate both?
To integrate Oracle Database hosted on an Azure VM with Katalon Studio on a remote Windows Server, follow these structured steps:
1. Network Configuration
- Azure Network Security Group (NSG):
- Add an inbound rule to allow TCP traffic on port 1521 (Oracle’s default) from the Katalon server’s IP.
- (Optional) Restrict access to the Katalon server’s IP for security.
- Windows Firewall on Azure VM:
- Ensure port 1521 is open in the Windows Firewall for inbound connections.
2. Oracle Database Setup
- Listener Configuration:
- Edit
listener.orato bind the listener to the VM’s public IP or0.0.0.0:
- Edit
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)
- Restart the listener:
lsnrctl stop
lsnrctl start
- TNS Configuration:
- Update
tnsnames.orawith the correct service name and host:
- Update
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = <Azure_VM_Public_IP>)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
- User Permissions:
- Create a user with remote access privileges:
CREATE USER katalon_user IDENTIFIED BY <password>;
GRANT CONNECT, RESOURCE TO katalon_user;
3. Katalon Studio Configuration
- JDBC Driver:
- Download the Oracle JDBC driver (e.g.,
ojdbc8.jarfor Oracle 19c/12c) from Oracle’s site. - Place the JAR file in Katalon’s
Driversdirectory. - Refresh the project: Right-click project > Refresh.
- Download the Oracle JDBC driver (e.g.,
- Connection Script:
Use Katalon’s Database keywords to connect:
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.db.DBManager
// JDBC URL format: jdbc:oracle:thin:@host:port/service_name
def url = 'jdbc:oracle:thin:@<Azure_VM_Public_IP>:1521/ORCL'
def user = 'katalon_user'
def password = '<password>'
// Establish connection
def conn = DBManager.getConnection(url, user, password)
// Execute query (example)
def rs = DBManager.executeQuery(conn, 'SELECT * FROM DUAL')
WebUI.comment(rs.toString())
// Close connection
DBManager.closeConnection(conn)
4. Connectivity Testing
- From Katalon Server:
- Use
tnspingto test Oracle connectivity:
- Use
tnsping ORCL
- Test with SQL*Plus:
sqlplus katalon_user/<password>@//<Azure_VM_Public_IP>:1521/ORCL
5. Troubleshooting
- Common Errors:
- ORA-12541: TNS No Listener: Check NSG/firewall rules and Oracle listener status.
- ORA-01017: Invalid Credentials: Verify username/password.
- Driver Not Found: Ensure the JDBC JAR is in
Driversand the project is refreshed.
- Logs:
- Check Katalon’s Console for detailed error messages.
- Review Oracle’s
alert.logand listener logs (listener.log).
6. Security Recommendations
- VPN/Private Link: Use Azure VPN Gateway or Private Link for secure connectivity.
- SSL Encryption: Configure Oracle for SSL/TLS to encrypt data in transit.