Skip to content

RFC: SQL Client Connection URL format

Thomas Segismont edited this page Jan 5, 2021 · 1 revision

Introduction

Vert.x SQL Client can connect to the database server using a connection URL string or a data object, there is dedicated connection URL parser for each implemenation of the SQL Client.

There're some limits currently

  • it would not be good to expose the connection string in the SPI factory but with different implemenation formats internally
  • we have to maintain the parser individually while the code structure is mostly the same.
  • user can connect with connection URL string but still has to to specify a PoolOptions data object if he wants to tune the pool options
  • many network options(timeout, retry, security) in Vert.x core are not supported

Current status:

Postgres

It uses the libpq format postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...] in the official site

Parameters supported:

  • port
  • host
  • hostaddr
  • user
  • password
  • dbname
  • sslmode
  • application_name
  • fallback_application_name
  • search_path

MySQL

It uses the format [scheme://][user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2... in the official site

the connection URL is defined in the server part therefore it is not related to any specific client, note the MySQL format is also a bit different from the Postgres format, and that's why we don't share a common parser.

Parameters supported:

  • port
  • host
  • socket
  • user
  • password
  • schema
  • useaffectedrows

DB2

It uses the JDBC format in the official site but makes some modifications in the scheme designator.

an example URL is like this db2://user:secret@localhost/dbname?param1=foo&param2=bar

Parameters supported:

  • user
  • password
  • host
  • port
  • socket
  • database

SQL Server

The SQL Server does not provide a connection URL format, but there is one in the JDBC implementation.

The connection URL string is not supported yet but there is ongoing effort in https://github.com/eclipse-vertx/vertx-sql-client/pull/859 and it tries to use a custom format.

Goals

  • standarize the parameters in the URL
  • include pool options in the connection URL parameters?
  • Provide a unified connection URL format?

Non Goals

Clone this wiki locally