Skip to main content

Setting Up Connectors

This topic describes how to set up connectors within Harness DB DevOps.

Setting Up Connectors for Databases

JDBC Connectors

The JDBC connector accepts the following:

  • JDBC URL: The database URL (string)
  • Username: Username (string / secret)
  • Password: Password (secret)

It performs a test connection using a delegate with a delegate selector or any available delegate. Ensure the delegate has network access to the database.

The JDBC connector is used for connecting to your database instance.


URL Examples

DatabaseJDBC URL Format
ORACLEjdbc:oracle:thin:@//{host}:{port}/{servicename}
POSTGRESjdbc:postgresql://{host}:{port}/{dbName}?sslmode=disable
COCKROACHDBjdbc:postgresql://{HOST}:{PORT}/{DBNAME}
SQLSERVERjdbc:sqlserver://{host}:{port};trustServerCertificate=true;databaseName={dbName}
MYSQLjdbc:mysql://{host}:{port}/{dbName}
MONGODBmongodb://{host}:{port}/{dbName}/?authSource=admin
MongoDB Atlasmongodb+srv://{username}:{password}@{cluster}/{dbName}/?authSource=admin
GOOGLE SPANNERjdbc:cloudspanner:/projects/{project-id}/instances/{instance-id}/databases/{database-name}?lenient=true
MongoDB SSLmongodb://{host}:{port}/{dbName}/?tls=true&authSource=admin
POSTGRES SSLjdbc:postgresql://{host}:{port}/{dbName}?ssl=true
SQLSERVER SSLjdbc:sqlserver://{host}:{port};databaseName={dbName};encrypt=true;trustServerCertificate=false;
MYSQL SSLjdbc:mysql://{host}:{port}/{dbName}?useSSL=true
ORACLE SSLjdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST={host})(PORT={port}))(CONNECT_DATA=(SERVICE_NAME={servicename})))
COCKROACHDB SSLjdbc:postgresql://{host}:{port}/{dbName}?sslmode=require

Setting Up MongoDB

MongoDB connections in Harness DB DevOps support both self-hosted and cloud-based MongoDB instances.

Prerequisites for MongoDB

  1. Connection Format:

    • Use mongodb+srv:// for MongoDB Atlas and cloud instances.
    • Use mongodb:// for self-hosted instances.
  2. Authentication:

    • Username/Password: Database user credentials
    • authSource: Must be specified (typically admin)
    • Database: Target database name must be included in the URL
  3. Network Access:

    • Ensure the delegate has network connectivity to the MongoDB cluster
    • For MongoDB Atlas, whitelist the delegate's IP address

MongoDB URL Requirements

  • The connection string must include +srv for cloud instances
  • The target database must be specified in the URL path
  • The database user must have appropriate read/write permissions on the target database

Setting Up Google Spanner

Google Spanner uses a unique JDBC URL format and does not require a password for authentication. Instead, authentication is handled via Service Account (SA) credentials.

Prerequisites for Google Spanner

  1. Authentication:
    • Google Service Account (GSA) json key
    • The GSA must have the following roles:
      • roles/spanner.databaseAdmin
      • roles/spanner.databaseUser

Connector FAQs

Why can't I connect to my Oracle database with a   sys as sysdba   username?

Sometimes, users want to login to their database using the sys as sysdba username. To do so properly with Harness:

  1. Your JDBC URL should have the query parameter internal_logon=sysdba
  2. Your Username should be sys.

Go to Oracle's documentation for information about logging on as sys.