Duburl provides a standardized URL-style mechanism for providing database connection information and opening a DbConnection in the .NET ecosystem

connection-string, database, sql, dependency-injection, ado-net, adonet, connection-uri, connection-url, database-url, mysql, odbc, oledb, oracle, postgresql, sql-server, sqlite
Install-Package DubUrl.Extensions.DependencyInjection -Version 0.1.142



DubUrl provides a standard, URL style mechanism for parsing database connection strings and opening DbConnections for .NET. With DubUrl, you can parse and open URLs for popular databases such as Microsoft SQL Server, PostgreSQL, Mongodb, Neo4j, MySQL, SQLite3, Oracle Database and most of the other SQL databases. This project is inspired from the package dburl available in the GoLang ecosystem and is trying to match the aliases for portocols.

About | Overview | Quickstart | Examples | Schemes | Installing | Using


Social media: twitter badge

Releases: nuget licence badge

Dev. activity: GitHub last commit Still maintained GitHub commit activity

Continuous integration builds: Build status Tests

Status: stars badge Bugs badge Features badge Features badge Features badge Features badge Top language

Database Connection URL Overview

Supported database connection URLs are of the form:



Component Description
alias database type (see below)
driver driver/provider name (only for odbc/oleodbc)
user username
pass password
host host
dbname* database, instance, or service name/ID to connect to
?opt1=... additional database driver options (see respective SQL driver for available options)

* for Microsoft SQL Server, /dbname can be /instance/dbname, where /instance is optional. For Oracle Database, /dbname is of the form /service/dbname where /service is the service name or SID, and /dbname is optional. Please see below for examples.


Database connection URLs in the above format can be parsed to a standard connection string with the [Parse] as such:

string connectionUrl = "mssql://{server}/{database_name}";
string connectionString = new ConnectionUrl(connectionUrl).Parse();

Additionally, a simple helper, [Open], is provided that will parse, open, and return a standard DbConnection.

string connectionUrl = "mssql://{server}/{database_name}";
IDbConnection connection = new ConnectionUrl(connectionUrl).Open();

If you don't want to open the connection but only return it and manage its state by yourself, use the function [Connect]

string connectionUrl = "mssql://{server}/{database_name}";
IDbConnection connection = new ConnectionUrl(connectionUrl).Connect();

Example URLs

The following are example database connection URLs that can be handled by [Parse], [Connect] and [Open]:




Protocol Schemes and Aliases

ADO.Net data providers

The following databases and their associated schemes are supported out of the box:

Database Aliases Provider Invariant Name
Microsoft SQL Server mssql, ms, sqlserver System.Data.SqlClient
MySQL mysql, my MySqlConnector
PostgreSQL pg, pgsql, postgres, postgresql Npgsql
Oracle Database oracle, or, ora Oracle.ManagedDataAccess
SQLite3 sq, sqlite Microsoft.Data.Sqlite
IBM DB2 db2 IBM.Data.Db2
MariaDB maria, mariadb MySqlConnector
Snowflake sf, snowflake Snowflake.Data
Teradata td, teradata, tera Teradata.Client
CockRoachDB cr, cockroach, crdb, cdb Npgsql
Firebird SQL fb, firebird FirebirdSql.Data.FirebirdClient
Timescale ts, timescale Npgsql


Install in the usual .NET fashion:

Install-Package DubUrl


Check the first steps guide on the website.

Please note that DubUrl does not install actual drivers, and only provides a standard way to [Parse] respective database connection URLs then [Connect] or [Open] connections.