Back to Library

SQL Connection Templates

SQL Server (Standard)

Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;

Note: Standard connection with username and password.

SQL Server (Windows Authentication)

Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

Note: Uses current Windows user identity to connect.

SQL Server (LocalDB)

Server=(localdb)\mssqllocaldb;Database=myDataBase;Trusted_Connection=True;

Note: Used for local development with Visual Studio.

MySQL (Standard)

Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

Note: Standard connection for MySQL / MariaDB.

PostgreSQL

Host=myServerAddress;Database=myDataBase;Username=myUsername;Password=myPassword;

Note: Standard connection for PostgreSQL (Npgsql).

SQLite

Data Source=myDataBase.db;Version=3;

Note: File-based SQLite connection.

SQLite (In-Memory)

Data Source=:memory:;Version=3;New=True;

Note: In-memory database, wiped on connection close.

Oracle (ODP.NET Managed)

Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;

Note: Managed driver connection string.

Entity Framework Core (SQL Server)

optionsBuilder.UseSqlServer("Server=.;Database=MyDb;Trusted_Connection=True;");

Note: Code snippet for DbContext initialization.

Developer Connection String Library

Connection strings are notoriously difficult to remember, and one missing semicolon can lead to frustrating debugging sessions. This library provides standardized, tested templates for all major database providers used in .NET development.

Whether you're setting up a local SQLite database, connecting to a legacy Oracle server, or configuring an Azure SQL instance, you can find the correct syntax here instantly.