Connect Oracle Database to Visual Studio Code by installing the SQLTools or Oracle Developer Tools extension, creating a connection profile, and testing the link.
Open the Extensions panel, search for “SQLTools” or “Oracle Developer Tools for VS Code,” and click Install. Once installed, open the SQLTools sidebar, select Add New Connection, choose Oracle, and proceed to the profile form.
Fill in User, Password, Connect String (host:port/service_name or a TNS alias), and optionally Connection Name.VS Code stores the password securely in its secret store.
Yes. Ensure your local tnsnames.ora is reachable by the Oracle Instant Client. Enter the alias (for example ORCLPDB1) in the Connect String field.
SQLTools accepts either EZConnect (host:port/service_name
) or a TNS alias. Example: localhost:1521/ORCLPDB1
.
Click Test Connection in the profile dialog.A green toast “Connected successfully” confirms connectivity; otherwise, review firewall rules, service name, and credentials.
Open a new .sql file, select the desired connection in the status bar, write your SQL, and press Ctrl+Enter (⌘+Enter on macOS).Results appear in an inline grid.
SELECT c.name, o.order_date, o.total_amount
FROM Customers c
JOIN Orders o ON o.customer_id = c.id
WHERE o.order_date > SYSDATE - 30;
Use the latest Basic or Full Instant Client, pin the version to match your database, and keep tnsnames.ora in $TNS_ADMIN. Set SQLNET.EXPIRE_TIME = 10 to avoid idle disconnects.
Wrong driver path: VS Code cannot find libclntsh.dylib/so.Add the Instant Client folder to PATH or LD_LIBRARY_PATH.
Service name typo: ORCLPD1 instead of ORCLPDB1 causes ORA-12514. Copy the exact name from select service_name from v$services;
.
.
No. The lightweight Basic or Basic Lite Instant Client is sufficient for SQLTools and Oracle Developer Tools.
Yes. Create an SSH tunnel first (ssh -L 1521:dbhost:1521 user@bastion
) and point the VS Code connection to localhost:1521.
The service name is wrong or the listener isn’t registering it. Verify with lsnrctl status
or query v$services
.