Connect QGIS to an Oracle Autonomous Database

Karin Patenge
Oracle Developers
Published in
3 min readMar 1, 2023

QGIS is an open-source tool used frequently by GIS specialists to work with geospatial data. The Oracle Autonomous Database is a fully automated Oracle Database service that makes it easy for all organizations to develop and deploy application workloads regardless of complexity, scale, or criticality. The service is available in the Oracle Cloud Infrastructure (OCI) and via Microsoft Azure. Oracle Database is a great platform to securely store, process, and query geospatial data.

Spatial Database
Geospatial data management and location-enabled applications using the Oracle Database

How can QGIS connect to an Oracle Autonomous Database? With three simple steps, you can access geospatial data managed in an Autonomous Database and use it in your QGIS projects.

  1. Download the client credentials (aka “Wallet”) for your Autonomous Database and extract them into a folder of your choice.
  2. Use the information from within the wallet to set up the connection in QGIS. Test the connection.
  3. Use the spatial data stored in your Autonomous Database instance.

Once, you have followed the steps, the result of testing your connection should give you confidence.

Successfully tested a new QGIS connection
QGIS connection to an Autonomous Database instance successfully set up

But let´s do it step-by-step.

Step 1: Download and unzip the wallet

As a prerequisite, I assume you have access to the Oracle Cloud and set up an Autonomous Database instance, either an Autonomous Data Warehouse (ADW) or an Autonomous Transactional Processing (ATP) database instance, depending on the type of workload.

In the following recording, I use an Always Free instance of Autonomous Transactional Processing with a public endpoint.

Downloading the wallet of an Autonomous Database instance

Step 2: Extract the connection details from tnsnames.ora and set up the connection in QGIS

In QGIS, to connect to an Oracle Database, you need to provide the connection details. You can extract most of them from the tnsnames.ora file contained in the wallet you have just downloaded and extracted.

Then either use:

  • Layer > Data Source Manager > Oracle or
  • Browser Panel > (Right click on) Oracle

to create a new Oracle connection.

Fill out the necessary parameters.

  • Name: <Free text as connection name>
  • Database: <service_name>?wallet_location=<path of your wallet location>&https_proxy=<proxy_server>&https_proxy_port=<proxy port>
  • Host: <protocol>://<host>
  • Port: <Insert the Autonomous Database port here, typically 1522>

Please note two things:

  1. The two parameters
    &https_proxy=<proxy_server>&https_proxy_port=<proxy port>
    added after the wallet location are optional.
  2. You need to specify tcps as protocol in front of the hostname.
Connection details for an Oracle Autonomous Database
QGIS connection configuration for an Autonomous Database instance

Testing your connection is simple. Just click on the “Test Connect” button. If everything is properly configured, you get a success message.

Step 3: Use your spatial data in a QGIS project

Now you can open your connection, check the existing spatial data, and add them as layers to your QGIS projects.

Browse the QGIS connections to search for spatial data
Browsing the spatial application data stored in your Autonomous Database instance

That´s it.

Congratulations! You have successfully connected QGIS to your Autonomous Database instance.

Do you want to learn more about how to use Oracle Spatial technologies, then check out the following resources:

--

--

Karin Patenge
Oracle Developers

I am a Product Manager with the Oracle Database team covering Spatial and Graph technologies. The views expressed here are my own.