Learn how to connect to your cloud database from Visual Studio Code. In this blog, how to connect from Oracle SQL Developer in VS Code.

In Oracle Cloud Infrastructure (OCI) you have several options for running an Apex Service. To connect to this Apex database and use local tools like Visual Studio Code, you need to use the right database. The regular Apex Developer Database will not let you connect to it from Visual Studio Code. You are stuck with SQL Worksheet inside apex or Oracle Database Actions – SQL
Under Developer Services you can create an Apex Instance, but this database will not let you use local tools like Sql Developer or Visual Studio Code to connect to it.
Under Oracle Ai Database you can create an Autonomous Ai Database. All Oracle Databases come with Apex. This database type will let you connect to it using a wallet.

Press Create Autonomous AI Database.
Follow the instructions below.

Fill in display name and database name. Choose your compartment. Select Transaction Processing. This workload type will let you use credentials/wallet to connect to the database. The Apex workload will not allow you to do this. But as you know, every Oracle Database have Apex installed.

Choose Always Free if you want it to be free. Database version 26ai. Fill inn password for your ADMIN user.

Select “Secure access from anywhere”. Fill in your contact email and press Create. A few minutes later the database will be provisioned and ready to use.

Just for show; Apex is available under Tool configuration. Press the Database Connection button to download wallet.

Choose Instance wallet if you want a wallet only for the database you just created or Regional wallet if you want a wallet to access all AI-database in your region.

Give the wallet a password and press Download. The downloaded zip will be used in Visual Studio Connection settings.
Use wallet to connect to the database from Visual Studio Code.

In VSCode, under extensions. Find Oracle SQL Developer for VSCode and install it.

Under connections, press Create Connection.

Give the connection a name. Choose connection type “Cloud Wallet”. Press “Choose File” and select the wallet zip file. Service is the default the _HIGH TNS name. Set admin as username and the password for the database you created earlier. Check “Save Password”. Press Test, and if successful, press Save.
If you already have an apex developer schema you want to connect to in stead, use username and password for this schema.

Under connection, press the Open SQL Worksheet button.

The good old “Select * from dual” gives one row back. Success!
In my next blog I will show you how to create an Apex schema from VS Code, to start coding locally.

Leave a Reply