Fact-checked by Grok 2 weeks ago

Connection string

A connection string is a formatted string that provides the necessary parameters for an application or driver to establish a connection to a database management system (DBMS), including details such as the server hostname, port number, database name, authentication credentials, and optional settings like or timeout values. These strings are passed from a provider to a source during initialization, enabling standardized communication between client applications and databases in environments like or ODBC. The format typically consists of semicolon-separated key-value pairs, though URI-like structures are also supported in some systems such as and . Connection strings originated with (ODBC) in 1992 as a mechanism to encapsulate connection details in a single, portable string, simplifying configuration in database-driven applications. They are essential for technologies like Microsoft's , where the ConnectionString property of classes such as SqlConnection accepts these strings to initiate sessions with SQL Server or other compatible data sources. In environments, connection strings often incorporate a connect descriptor specifying the network location and protocol, as seen in ODP.NET implementations. Similarly, PostgreSQL's libpq library uses connection strings to define parameters like host, user, and database, supporting both keyword=value formats and RFC 3986-compliant URIs for flexibility in multi-host setups. Common components in a connection string include Server or Host for the database server address, Database or Initial Catalog for the target database, User ID and Password for authentication, and Port for non-default ports. For example, a basic SQL Server connection string might appear as:
Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
This format ensures interoperability across drivers while allowing provider-specific extensions. In MySQL, equivalent strings use keys like Server, Database, and Uid, often via the MySQL Connector/JDBC driver. Due to their inclusion of sensitive information like passwords, connection strings must be handled securely to prevent exposure; best practices recommend storing them in encrypted configuration files rather than hardcoding them in source code. In .NET applications, for instance, they are commonly placed in the <connectionStrings> section of app.config or web.config files, with access via the ConfigurationManager class. Modern frameworks like Entity Framework Core also support connection strings for ORM-based database interactions, emphasizing environment-specific overrides for production security.

Overview

Definition

A connection string is typically a list of key-value parameter pairs, delimited by semicolons in systems like and ODBC, that specifies the information required to establish a connection between an application and a data source, such as a . This format allows data providers, like those in or ODBC, to interpret the parameters and initialize the connection process. There is no universal standard for connection strings; their format and parameters are defined by individual data providers and database systems. At its core, a connection string includes essential details such as the provider type (e.g., specifying the database driver), address (identifying the host), database name (targeting the specific ), authentication credentials (like user ID and password), and various connection options (such as timeout settings or pooling configurations). These components collectively define the parameters needed for , location, and operational behavior without embedding executable code. Unlike database connection URLs employed in technologies like JDBC, which adopt a hierarchical structure (e.g., starting with a prefix followed by , , and query parameters), connection strings are typically , provider-specific, and organized as a flat sequence of keyword-value pairs, often separated by semicolons in many providers though some support formats. This distinction makes connection strings more flexible for vendor-specific customizations while remaining human-readable for configuration purposes.

Purpose and Role

A connection string serves as a critical artifact in database-driven applications, providing the necessary parameters to data access APIs for establishing, managing, and terminating connections to relational databases or other data sources. It encapsulates details such as the address, database name, credentials, and communication protocols, which are passed to provider-specific connection classes to initiate secure and efficient interactions. This role is fundamental in enabling applications to access and manipulate data without embedding hardcoded details directly in the source code, thereby supporting modular and maintainable . In the application lifecycle, connection strings are integral during the initialization of connection objects, such as the SqlConnection class in ADO.NET, where they configure behaviors like connection pooling to reuse existing connections and reduce overhead, timeouts to limit wait times for establishing links, and encryption settings to secure data transmission over networks. For instance, specifying pooling options in the string allows the provider to maintain a pool of active connections, optimizing performance in high-traffic scenarios by avoiding the repeated cost of opening new ones. Similarly, timeout and encryption keywords ensure reliable and protected connectivity, adapting to the application's operational requirements without altering the core logic. These configurations are applied at runtime, facilitating dynamic adjustments as the application scales or encounters varying network conditions. The broader impact of connection strings lies in their ability to enhance portability across development, testing, and production environments by externalizing connection details into configuration files, such as app.config for desktop applications or web.config for web applications. This practice allows developers to modify database endpoints, credentials, or settings without recompiling the application, promoting flexibility in deployment and reducing risks associated with environment-specific adaptations. By centralizing these configurations, connection strings support standardized practices in architectures, ensuring consistency and ease of maintenance across diverse systems.

Historical Development

Origins in ODBC

The connection string concept originated with the release of Microsoft's (ODBC) 1.0 specification in September 1992, as part of the Windows Open Services Architecture (WOSA) initiative aimed at standardizing database access across diverse systems. This specification introduced connection strings as a flexible mechanism to abstract interactions with database drivers, allowing applications to establish connections without embedding vendor-specific code, thereby promoting portability in Windows environments. A core early feature was the integration of Data Source Names (DSNs), which enabled centralized storage of connection parameters in the Windows registry, reducing redundancy and simplifying configuration for users and developers. Connection strings could reference a DSN via the DSN keyword, such as DSN=MyDataSource;UID=username;PWD=password, or specify details directly without a DSN using driver-specific keywords. This design decision supported both simple and complex scenarios, with the SQLDriverConnect API function—introduced in ODBC 1.0—serving as the primary interface for parsing and applying these strings to connect to data sources. Driver-specific keywords formed another foundational element, allowing customization for individual database engines; for instance, the [DRIVER](/page/The_Driver) keyword identified the target driver, as in DRIVER={SQL Server};SERVER=servername;DATABASE=dbname. These keywords, paired with generic ones like UID for user ID and PWD for password, followed a semicolon-separated key-value format that became the de facto standard under Microsoft's stewardship. Microsoft's standardization efforts positioned ODBC—and by extension, connection strings—as an integral component of the Windows developer ecosystem, with the initial SDK release facilitating widespread adoption by application vendors seeking cross-database compatibility. This foundation influenced database by emphasizing driver abstraction, setting the stage for broader in .

Evolution in .NET and Other Frameworks

Connection strings were introduced in the .NET Framework 1.0, released on February 13, 2002, as part of the architecture within the System.Data namespace. This marked a significant standardization of connection string formats for managed data access, enabling consistent usage across provider-specific classes such as SqlConnection for SQL Server, OleDbConnection for providers, and OracleConnection for databases. Building briefly on ODBC roots, extended the key-value pair model to support the disconnected, data-centric model of .NET applications. Key evolutions in .NET connection strings included the integration of Windows Authentication via the "Integrated Security=SSPI" parameter, which leveraged the Security Support Provider Interface (SSPI) for secure, credential-less connections to SQL Server and other compatible data sources. Connection pooling became enabled by default in providers, with parameters like "Max Pool Size" defaulting to 100 and "Min Pool Size" to 0, optimizing resource management by reusing connections based on matching connection strings and user credentials. Additionally, the .NET configuration system introduced XML-based storage of connection strings in app.config or web.config files under the section, allowing centralized, modifiable settings without recompilation. Subsequent developments influenced cross-platform data access, notably with the release of the ADO.NET Entity Framework (EF) version 1.0 in 2008 as part of .NET Framework 3.5 Service Pack 1. EF adopted and extended connection strings by incorporating Entity Data Model (EDM) metadata, such as in formats like "metadata=res:///Model.csdl|res:///Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string='data source=server;initial catalog=db;integrated security=SSPI;'". This facilitated object-relational mapping while maintaining compatibility with underlying ADO.NET providers. The Java Database Connectivity (JDBC) API, introduced in 1997, uses URL-based connection formats (e.g., "jdbc:sqlserver://server:1433;databaseName=db;integratedSecurity=true"), which shared conceptual similarities but differed from .NET's semicolon-separated key-value syntax, emphasizing protocol-specific URIs over generalized strings.

Structure and Components

Basic Format

A connection string is fundamentally a semicolon-delimited list of key-value pairs, where each pair follows the format keyword=value, and semicolons separate the pairs. For instance, a basic structure might appear as keyword1=value1; keyword2=value2. Optional spaces may surround the semicolons for readability, though they are not required by the syntax. This format originated from ODBC standards and has been adopted across various database access technologies. To handle special characters within values, such as semicolons or equals signs, the value must be enclosed in double quotes; for example, keyword="value;with;semicolon". This escaping rule prevents misinterpretation of the string during parsing. Keywords in connection strings are generally case-insensitive across most providers, allowing variations like Server or server to be treated equivalently. Connection strings often begin with a provider to specify the underlying data access technology, such as Provider=[Microsoft](/page/Microsoft).Jet.OLEDB.4.0; for providers. In contrast, native client connections like those for SQL Server may omit an explicit provider keyword, relying instead on implicit conventions such as starting directly with server details. This ensures compatibility with the appropriate driver or .

Key Parameters

Connection strings consist of key-value pairs that configure database connections, with core parameters defining essential connection details such as the server location, target database, and authentication credentials. The Server (or equivalently Data Source) parameter specifies the hostname, IP address, or instance name of the database server to connect to, enabling the client to locate the remote data source. For example, in SQL Server connections via ADO.NET, this might be set to a value like "localhost" or a full server name such as "myserver.database.windows.net". The Initial Catalog (or Database) parameter identifies the specific database on the server to use as the default context for queries and operations. Authentication is handled by the User ID (or UID) parameter, which provides the username for login, paired with the Password (or PWD) parameter for the corresponding credential. These parameters are fundamental across most relational database providers, ensuring secure and targeted access. Several optional parameters enhance connection behavior and reliability. The Connection Timeout parameter sets the maximum duration (in seconds) to attempt establishing the before failing, with a default value of 15 seconds in SQL Server providers. The Encrypt parameter, a flag (true or false), determines whether the connection uses SSL/TLS encryption for , defaulting to false unless specified otherwise. For scenarios requiring concurrent operations, the MultipleActiveResultSets (or MARS) parameter enables multiple active SQL statements on a single connection when set to true, which is false by default and useful for improving performance in multi-query applications. Parameter names and behaviors vary by provider to accommodate different authentication models and standards. In SQL Server connections, Integrated Security set to "SSPI" or "true" leverages Windows Authentication, bypassing explicit User ID and Password for domain-based logins. In contrast, ODBC connections typically use UID and PWD for explicit credentials, alongside Driver to specify the ODBC driver (e.g., "SQL Server") and Server for the host. These variations ensure compatibility across APIs like ADO.NET and ODBC while maintaining core functionality.

Usage Across Technologies

In ADO.NET

In ADO.NET, connection strings serve as the primary mechanism for establishing database connections within .NET applications, providing the necessary parameters to initialize and manage interactions with data sources through managed providers such as .Data.SqlClient. These strings are typically passed directly to the constructor of connection classes, such as SqlConnection, to instantiate an object that represents a connection to a specific . For instance, the SqlConnection(string connectionString) constructor accepts a connection string as its sole parameter, which is then used to open the connection via the Open() method, enabling subsequent data access operations like querying or updating records. To facilitate maintainability and deployment, integrates connection strings with application systems. In .NET Framework applications, connection strings are defined in the <connectionStrings> section of files like app.config or web.config, structured as key-value pairs with a unique name for each entry. Developers access these at using the ConfigurationManager.ConnectionStrings collection from the System.Configuration namespace, retrieving a specific string via its name (e.g., ConfigurationManager.ConnectionStrings["MyDb"].ConnectionString) to pass it to a connection constructor. In modern .NET (version 5 and later, including .NET 9 as of 2025), is handled via the .Extensions.Configuration package, typically storing connection strings in JSON files such as appsettings.json or appsettings.Development.json. Access occurs through the IConfiguration interface, for example: builder.Configuration.GetConnectionString("MyDb"). This approach supports environment-specific overrides and integration with secret management. ADO.NET supports advanced features for securing and optimizing connection strings, including dynamic adjustments for performance. Connection strings can be modified at to tune connection pooling behaviors, such as setting the Max Pool Size parameter to 100 (or higher based on application needs) to limit the number of concurrent connections in a , thereby balancing resource usage and scalability while avoiding the default limit of 100. For security, in , sensitive connection strings in configuration files can be encrypted using protected configuration providers, such as the RsaProtectedConfigurationProvider, which leverages asymmetric key encryption to protect elements like passwords; decryption occurs transparently during access. In modern .NET, best practices recommend avoiding file-based storage of secrets; instead, use environment variables, User Secrets for development (via Microsoft.Extensions.Configuration.UserSecrets), or cloud-based solutions like Key Vault for production environments to securely manage credentials without embedding them in configuration files.

In ODBC and OLE DB

In (ODBC), connection strings provide a flexible mechanism for establishing database connections, particularly through the SQLDriverConnect function, which extends the capabilities of the more basic SQLConnect function by accommodating detailed keyword-value pairs beyond just a (DSN), , and . SQLConnect relies on three simple parameters to initiate a via the ODBC Driver Manager, which routes requests to the appropriate driver, but it lacks support for complex configurations. In contrast, SQLDriverConnect accepts a full connection string, often integrating a DSN for driver selection while specifying additional attributes like server names, modes, and timeouts, enabling connections to data sources that demand customized information. This approach allows ODBC applications to dynamically construct connections without predefined DSNs, with the Driver Manager parsing the string to load the correct driver and establish the link. Object Linking and Embedding Database (OLE DB) employs connection strings in a COM-based architecture, where they are passed to the IDataInitialize::GetDataSource method to instantiate and configure a data source object (IDBInitialize), serving as the foundation for subsequent session creation. This method parses the connection string's properties—such as provider specifications, details, and credentials—to set initialization properties on the data source, after which developers can obtain session objects (IDBCreateSession) for executing commands and retrieving rowsets. OLE DB supports a range of providers, including the Microsoft OLE DB Provider for ODBC (MSDASQL), which bridges OLE DB interfaces to underlying ODBC drivers, allowing applications to leverage ODBC data sources through OLE DB's object model without direct ODBC calls. For instance, a connection string with "Provider=MSDASQL.1" routes the request through the ODBC bridge, combining OLE DB's structured with ODBC's broad driver compatibility. Key differences between ODBC and OLE DB connection string usage stem from their architectural foundations: ODBC centers on a procedural managed by a central Driver Manager that interprets the connection string to select and invoke for straightforward connection establishment. , as a successor built on () interfaces, uses the connection string to initialize a hierarchical object model, where the data source object not only handles connectivity but also enables the derivation of session, command, and rowset objects for more integrated data manipulation. This -oriented design in provides greater encapsulation and extensibility compared to ODBC's driver-manager emphasis, though both ultimately facilitate access to relational data sources via standardized strings.

Examples

SQL Server Connections

SQL Server connection strings are formatted specifically for the Microsoft .NET SqlClient provider, enabling applications to connect to instances of or Azure SQL Database using or . These strings typically include parameters for the server location, database name, authentication method, and optional settings for timeouts, , and certificate validation, ensuring compatibility with both on-premises and cloud-based deployments. The syntax follows a semicolon-delimited key-value pair structure, where keys like "" or "Data Source" specify the connection endpoint. A local often leverages Windows Integrated for trusted without explicit credentials, connecting to a default or named instance on the local machine. For instance, to access the Northwind sample database on :
[Server](/page/Server)=localhost;Database=Northwind;Integrated [Security](/page/Security)=true;
This configuration assumes the SQL instance is running locally and uses the current user's Windows credentials for access, which is ideal for development environments or internal applications where domain is sufficient. For remote connections requiring SQL Server authentication, the string includes explicit username and password parameters, along with a connection timeout to handle network latency. An example targeting a remote server for the Sales database might be:
Server=sqlserver.example.com;Database=Sales;User Id=admin;Password=pass123;Connection Timeout=30;
Here, "Connection Timeout=30" limits the wait time to 30 seconds before failing, preventing indefinite hangs in distributed systems. This approach is common in multi-tier applications where the client and server are separated by firewalls or across data centers. Advanced configurations incorporate security enhancements, such as and handling, particularly for SQL Database to enforce TLS transport security. A representative string for a secure setup could include:
Server=tcp:sqlserver.example.com;Database=Sales;User Id=admin;Password=pass123;[Encrypt](/page/Encrypt)=true;TrustServerCertificate=false;Connection Timeout=30;
The "=true" parameter mandates encrypted communication, while "TrustServerCertificate=false" requires validation of the server's against trusted authorities, mitigating man-in-the-middle risks in cloud environments. These options align with Microsoft's recommendations for production deployments involving sensitive data.

Oracle and MySQL Connections

Connection strings for databases typically utilize ODBC or drivers to establish connections, specifying the driver, server details, user credentials, and optionally a TNS alias for network configuration. A representative example for an ODBC connection is DRIVER={[Oracle](/page/Oracle) ODBC Driver};DBQ=oradb;UID=user;PWD=pass;, where the driver name is the installed ODBC driver (e.g., {Oracle ODBC Driver}), DBQ indicates the database instance or connection descriptor (e.g., TNS alias), and UID and PWD provide authentication details. This format adapts the standard ODBC structure to 's (OCI), enabling seamless integration with applications requiring database access without relying solely on DSN configurations. For databases, the .NET connector employs a semicolon-separated key-value format that emphasizes location, database selection, and security options. An example connection string using the .NET Connector is Server=localhost;Database=test;Uid=[root](/page/root);Pwd=secure;SslMode=Required;, which connects to a local instance, targets the test database, authenticates with credentials, and mandates SSL to protect . This approach highlights 's focus on explicit specifications, differing from Oracle's reliance on configurations. Variations in these connection strings accommodate vendor-specific networking needs, such as Oracle's with TNSNames for simplified alias —using Data Source=tnsname to reference entries in the tnsnames.ora file for remote server details—contrasted with MySQL's direct port specification like Port=3306 to override the default listening port. These adaptations ensure cross-vendor compatibility while leveraging each database's native tools for efficient, secure connections.

PostgreSQL Connections

PostgreSQL connection strings, used with the libpq library, support both keyword=value pairs and URI formats compliant with RFC 3986. A basic keyword example is:
host=localhost port=5432 dbname=mydb user=myuser password=mypass
This connects to a local PostgreSQL instance on the default port, selecting the mydb database with specified credentials. For URI format:
postgresql://myuser:mypass@localhost:5432/mydb
URIs offer flexibility for multi-host setups and are commonly used in applications like JDBC or Node.js drivers.

Security Considerations

Risks of Exposure

Connection strings often contain sensitive such as usernames, passwords, and details in , making them a prime target for unauthorized access if stored insecurely in configuration files. This storage exposes credentials to file access attacks, where attackers with or filesystem privileges can extract the data directly from files like web.config or app.config. Additionally, inadvertent commits to systems like can leak these strings publicly, with over 39 million such secrets exposed on in 2024 alone. Beyond credentials, connection strings may reveal infrastructure details, such as names or instance ports, which can aid attackers in mapping and targeting internal networks. If connection strings are constructed dynamically using unvalidated user input, they become vulnerable to injection attacks, allowing adversaries to append malicious parameters that alter database connections or escalate privileges. In the 2020s, heightened awareness of these risks has grown, as stolen connection string data can enable automated attacks across multiple systems.

Mitigation Strategies

To mitigate the risks associated with connection string exposure, such as unauthorized access to credentials, developers can encrypt sensitive sections of configuration files using tools like the ASP.NET IIS Registration Tool (aspnet_regiis.exe), which employs the Data Protection API (DPAPI) for machine-level or user-level encryption. This method protects the <connectionStrings> section in web.config files by running commands like aspnet_regiis -pe "connectionStrings" -app "/YourApp", ensuring that the encrypted data is only decryptable by the application on the designated machine. For cloud environments, Azure Key Vault provides a centralized service to store and retrieve connection strings as secrets, integrating seamlessly with applications via managed identities or access policies to avoid embedding credentials directly in code. Applications can reference these secrets using Key Vault references in app settings, such as @Microsoft.KeyVault(SecretUri=https://myvault.vault.azure.net/secrets/myconnectionstring/), which Azure automatically resolves at runtime without exposing the values. As alternatives to plaintext connection strings, integrated authentication methods like (formerly Azure AD) enable passwordless connections to databases such as SQL Database by leveraging token-based . For instance, a connection string can specify Authentication=Active Directory Integrated to use the application's managed identity, eliminating the need for embedded usernames or passwords. Environment variables offer another secure option for injecting connection strings at runtime, particularly in containerized or cloud deployments, where values are set externally (e.g., via App Service configuration or environment files) and accessed through frameworks like ASP.NET Core's IConfiguration. Secret management systems, such as , further enhance this by dynamically generating and rotating database credentials; 's database secrets engine can configure connections to SQL Server or and issue short-lived credentials via calls, reducing the window for credential compromise. Auditing and operational practices are essential to prevent inadvertent exposure during development and monitoring. Developers should configure logging frameworks, such as Serilog or .Extensions.Logging in .NET, to mask or exclude full connection strings from logs, adhering to guidelines that treat them as sensitive data equivalent to passwords. Additionally, applying least-privilege parameters in connection strings, like ApplicationIntent=ReadOnly for SQL Server Always On availability groups, routes queries to read-only replicas and limits the scope of potential damage from compromised credentials by enforcing read-only access. This parameter ensures that even if a connection is intercepted, it cannot perform modifications, aligning with broader security principles of minimizing permissions.

Best Practices and Troubleshooting

Configuration Guidelines

When constructing connection strings, optimization begins with selecting appropriate timeout settings to balance reliability and resource usage. For instance, setting Command Timeout=0 allows queries to run indefinitely without artificial interruption, which is useful for long-running operations but should be used judiciously to prevent resource exhaustion. Similarly, enabling connection pooling with parameters like Min Pool Size=0 ensures efficient reuse of , minimizing the overhead of establishing new in high-traffic applications. For file-based sources such as , employing relative paths (e.g., Data Source=.\mydatabase.db) simplifies deployment and avoids hardcoding absolute paths that may break across environments. Environment-specific configurations enhance and in and setups. In .NET applications, use configuration transforms in web.config or appsettings.json to differentiate connection strings between (e.g., local servers) and (e.g., cloud-hosted databases), automating switches during deployment. Additionally, implement startup validation by attempting a test connection using the parsed string, which confirms accessibility and correctness before full application initialization. This practice, often integrated into application lifecycle hooks, reduces runtime surprises. Performance tuning further refines connection strings by minimizing unnecessary elements. Omitting extraneous parameters decreases parsing time during connection establishment, as providers like SQL Server process only required options for faster initialization. For SQL Server, specifying named instances explicitly (e.g., Server=servername\instancename) ensures direct routing to the correct endpoint, avoiding default instance assumptions that could lead to delays. These adjustments collectively optimize throughput without compromising functionality, and for added protection, integrate brief checks aligned with broader security mitigations such as encryption enforcement.

Common Errors and Resolutions

One common parsing error in connection strings occurs when invalid keywords are used, such as misspelled terms or attributes not supported by the specific data provider, leading to exceptions like "Keyword not supported." For instance, in for SQL Server, specifying "IntegratedSecurity=true" is valid, but "Integrated Security=true" with a space or "TrustServerCertificate" without proper casing can trigger this error. To resolve this, consult the provider's official documentation for supported keywords and syntax, and utilize programmatic builders like SqlConnectionStringBuilder in to construct strings dynamically, which validates keys and handles formatting automatically. Another frequent issue arises from unescaped special characters in values, such as semicolons, signs, or backslashes in passwords or paths, which disrupt and result in "Format of the initialization string does not conform to specification starting at index X" errors. This is particularly problematic in ODBC and connections where attribute values must be properly quoted or escaped to avoid misinterpretation as delimiters. Resolution involves escaping problematic characters (e.g., using curly braces {} around values containing semicolons in ) or again employing connection string builders to manage escaping internally. Connectivity failures often manifest as "Cannot open database" or network-related errors when the server name, , or instance details in the connection string are incorrect, preventing the client from reaching the database . In SQL Server scenarios, this can stem from mismatched hostnames or blocked s like 1433, as seen in and ODBC connections. To troubleshoot, verify network reachability using tools like to test the (e.g., telnet servername 1433) or (SSMS) to attempt a direct connection with partial string elements, isolating whether the issue is server-specific or string-related. Authentication problems typically produce "Login failed" exceptions due to mismatched credentials, incorrect authentication modes (e.g., SQL vs. Windows), or invalid user mappings in the connection string. For example, providing a SQL Server login without the proper User ID and Password, or attempting Windows authentication across untrusted domains, triggers state 5 or 18456 errors in SQL Server logs. Fixes include switching to integrated security (Integrated Security=true) for Windows authentication where applicable, resetting or verifying passwords for SQL logins, and ensuring the login has database access permissions without exposing sensitive details in application logs or strings.

References

  1. [1]
    Connection Strings - ADO.NET - Microsoft Learn
    Aug 23, 2024 · A connection string contains initialization information that is passed as a parameter from a data provider to a data source.
  2. [2]
    18: 32.1. Database Connection Control Functions - PostgreSQL
    There are two accepted formats for these strings: plain keyword/value strings and URIs. URIs generally follow RFC 3986, except that multi-host connection ...
  3. [3]
    6.2.5 Connecting to the Server Using URI-Like Strings or Key-Value ...
    This section describes use of URI-like connection strings or key-value pairs to specify how to establish connections to the MySQL server, for clients such ...
  4. [4]
    Connection String Syntax - ADO.NET - Microsoft Learn
    Aug 23, 2024 · You can use the ConnectionString property to get or set a connection string for a SQL Server database. If you need to connect to an earlier ...
  5. [5]
    SqlConnection.ConnectionString Property (System.Data.SqlClient)
    The connection string that includes the source database name, and other parameters needed to establish the initial connection. The default value is an empty ...<|control11|><|separator|>
  6. [6]
    Connecting to Oracle Database
    To do so, the entire connect descriptor can be used as the "data source" . The connection string appears as follows: "user id=scott;password=tiger;data source=" ...
  7. [7]
    Connection strings - Microsoft.Data.Sqlite
    Dec 6, 2024 · A connection string is used to specify how to connect to the database. Connection strings in Microsoft.Data.Sqlite follow the standard ADO.NET syntax.
  8. [8]
    Connection Strings and Configuration Files - ADO.NET
    Jul 23, 2022 · Connection strings can be stored as key/value pairs in the connectionStrings section of the configuration element of an application configuration file.
  9. [9]
    Connection Strings - EF Core - Microsoft Learn
    Nov 12, 2024 · Connection strings in a UWP application are typically a SQLite connection that just specifies a local filename. They typically don't contain sensitive ...
  10. [10]
    Connection strings in ADO.NET - SQL Server - Microsoft Learn
    Jun 25, 2024 · Connection string syntax. A connection string is a semicolon-delimited list of key/value parameter pairs: C# Copy. keyword1=value; keyword2= ...
  11. [11]
    Connection String - an overview | ScienceDirect Topics
    A connection string is defined as a list of key/value pairs that the Connection object uses to find the Data Source, authenticate, and establish a connection.Components and Structure of... · Usage of Connection Strings...
  12. [12]
    Connection Strings Explained - ConnectionStrings.com
    The connection string contains the information that the provider need to know to be able to establish a connection to the database or the data file. Example of ...
  13. [13]
    Jdbc URL Format for Different Databases | Baeldung
    Jan 8, 2024 · The JDBC URL is an important parameter to establish the connection between our Java application and the database. However, the JDBC URL format ...
  14. [14]
    Using Connection Strings - Progress Documentation
    Aug 18, 2025 · The basic format of a connection string includes a series of keyword/value pairs separated by semicolons. The following example shows the ...
  15. [15]
    SQL Server Connection Pooling - ADO.NET - Microsoft Learn
    Jan 8, 2025 · Connection pooling reduces the number of times that new connections must be opened. The pooler maintains ownership of the physical connection.Missing: encryption | Show results with:encryption
  16. [16]
  17. [17]
    Encryption and certificate validation - ADO.NET Provider for SQL ...
    Jun 25, 2024 · Applications may request encryption of all network traffic by using the Encrypt connection string keyword or connection property.
  18. [18]
    Store Connection String in Web.config - ConnectionStrings.com
    It is very easy to store the connection string in a config file and there are several benefits in doing so. This article describes why and how to store the ...
  19. [19]
    Introduction to ODBC - ODBC API Reference
    **Summary of ODBC History (Focus on Connection Strings, DSN, Driver Keywords, 1992 1.0 Spec, Microsoft Standardization, Windows Adoption):**
  20. [20]
    A new release of ODBC for Modern Data Stores
    Jun 7, 2016 · ODBC was first released in September of 1992 as a C-based call-level interface for applications to connect to, describe, query, and update a ...
  21. [21]
    [MS-ODBCSTR]: ODBC Connection String Structure - Microsoft Learn
    Nov 1, 2022 · The [MS-ODBCSTR] specifies the format of the connection string used in Open Database Connectivity (ODBC).Missing: 1992 | Show results with:1992
  22. [22]
    SQLDriverConnect Function - ODBC API Reference - Microsoft Learn
    Jun 25, 2024 · It constructs a connection string from the data source name returned by the dialog box and any other keywords passed to it by the application.Diagnostics · Comments · Connection Attributes
  23. [23]
    Building the connection URL with the Microsoft JDBC Driver for SQL ...
    Nov 19, 2024 · The JDBC driver supports the use of IPv6 addresses with the connection properties collection, and with the serverName connection string property ...Connection properties · Connection examples
  24. [24]
    [MS-ODBCSTR]: ODBC Connection String Format - Microsoft Learn
    May 14, 2024 · The ODBCConnectionString structure specifies a set of keys and their associated values that MUST conform to the following ANBF syntax:.
  25. [25]
    Connection String Parameters | Npgsql Documentation
    To connect to a database, the application provides a connection string which specifies parameters such as the host, the username, the password, etc.Basic connection · Security and encryption
  26. [26]
    ODBC DSN and connection string keywords - SQL - Microsoft Learn
    Sep 8, 2025 · This page lists the keywords for connection strings and DSNs, and connection attributes for SQLSetConnectAttr and SQLGetConnectAttr, available in the ODBC ...Odbc Driver 18 And Newer · Odbc Driver 17 And Older · ClientkeyMissing: 1.0 | Show results with:1.0
  27. [27]
    Connection String Syntax - Microsoft Learn
    May 3, 2017 · A connection string is a string version of the initialization properties needed to connect to a data store and enables you to easily store connection ...
  28. [28]
    SqlConnection Constructor (System.Data.SqlClient) | Microsoft Learn
    Initializes a new instance of the SqlConnection class given a connection string, that does not use Integrated Security = true and a SqlCredential object that ...Definition · Overloads
  29. [29]
    Connecting to a Data Source (ODBC) - SQL Server | Microsoft Learn
    Jan 9, 2024 · SQLConnect is the simplest connection function. It accepts three parameters: a data source name, a user ID, and a password.SQLConnect · SQLDriverConnect
  30. [30]
    Connecting with SQLDriverConnect - ODBC API Reference
    Jun 25, 2024 · SQLDriverConnect is used to connect to a data source using a connection string. SQLDriverConnect is used instead of SQLConnect for the following scenarios.
  31. [31]
    Driver-Specific Connection Information - ODBC API Reference
    Jun 25, 2024 · SQLDriverConnect allows the driver to define an arbitrary amount of connection information in the keyword-value pairs of the connection string.
  32. [32]
    IDataInitialize::GetDataSource - Microsoft Learn
    May 2, 2017 · A pointer to a connection string containing the information to be used for creating and setting initialization properties on a data source ...
  33. [33]
    IDataInitialize | Microsoft Learn
    Jul 4, 2016 · Use the IDataInitialize interface to create a data source object using a connection string. You can also retrieve a connection string from an existing data ...
  34. [34]
    Microsoft OLE DB Provider for ODBC
    May 27, 2022 · The Microsoft ODBC Provider, however, allows ADO to connect to any ODBC data source. The provider is free-threaded and Unicode enabled.
  35. [35]
    Driver history for Microsoft SQL Server
    Aug 13, 2025 · There are three distinct generations of Microsoft ODBC drivers for SQL Server. The first "SQL Server" ODBC driver still ships as part of Windows ...
  36. [36]
    OLE DB Connection Type (SSRS) - SQL - Microsoft Learn
    Sep 27, 2024 · OLEDB is based on COM (Component Object Model) interfaces. OLEDB is a later technology than ODBC and earlier than ADO.NET data providers.
  37. [37]
    Using Connection String Keywords with OLE DB Driver for SQL Server
    Jun 25, 2024 · Connection strings are a list of keyword and associated values; each keyword identifies a particular connection attribute.
  38. [38]
  39. [39]
    Oracle Database ODBC Driver for Programmers
    Examples of valid connection strings are: 1) DSN=Personnel;UID=Kotzwinkle;PWD=;2) DRIVER={Oracle ODBC Driver};UID=Kotzwinkle;PWD=whatever;DBQ=instl_alias;DBA=W ...
  40. [40]
    25 Using the Oracle ODBC Driver - Database
    The following screenshot shows an example of the Oracle ODBC Driver Configuration dialog box. ... For more information, see the NETCA documentation and About ...
  41. [41]
    4.1 Creating a Connector/NET Connection String
    A connection string contains key-value pairs separated by semicolons, like: "server=127.0.0.1;uid=root;pwd=12345;database=test". It configures the ...
  42. [42]
    4.5 Connector/NET Connection Options Reference
    This chapter describes the full set of MySQL Connector/NET 8.0 connection options. The protocol you use to make a connection to the server (classic MySQL ...
  43. [43]
    Protecting Connection Information - ADO.NET - Microsoft Learn
    Aug 23, 2024 · A connection string presents a potential vulnerability if it isn't secured. Storing connection information in plain text or persisting it in ...Use Windows Authentication · Do not use Universal Data...
  44. [44]
    CWE-256: Plaintext Storage of a Password
    In some contexts, even storage of a plaintext password in memory is considered a security risk if the password is not cleared immediately after it is used. + ...
  45. [45]
    Tens of millions of secrets publicly exposed in GitHub last year
    Mar 13, 2025 · Fifty-eight of all leaked secrets were generic, including source code-embedded hardcoded passwords, database connection strings, plaintext ...Missing: git risks
  46. [46]
    About the secret risk assessment - GitHub Docs
    Malicious actors can use leaked secrets such as API keys, passwords, and tokens to gain unauthorized access to systems, databases, and sensitive information.
  47. [47]
    Connection strings should not be vulnerable to injections attacks
    If an attacker can control values that are inserted into the connection string, they may be able to insert additional parameters. These additional parameters ...Missing: risks | Show results with:risks
  48. [48]
    How a Connection String Injection Attack is Performed?
    Jul 23, 2025 · To protect against connection string injection attacks, developers should avoid including any user input into connections strings, such as a ...
  49. [49]
    Advanced Persistent Threat Compromise of Government Agencies ...
    Apr 15, 2021 · Change all account credentials, or other shared secrets (e.g., SNMP strings) that were potentially exposed: · Set account options for service ...Privilege Escalation And... · Mitigations · Solarwinds Orion Specific...
  50. [50]
    Credential Stuffing Prevention - OWASP Cheat Sheet Series
    This cheatsheet covers defences against two common types of authentication-related attacks: credential stuffing and password spraying.
  51. [51]
    Protecting Connection Strings and Other Configuration Information ...
    Jun 24, 2023 · In this tutorial we learn that ASP.NET 2.0 allows us to protect sensitive information by encrypting sections of the Web.config file.Introduction · Step 1: Exploring ASP.NET 2.0...
  52. [52]
    Use Key Vault References as App Settings - Azure - Microsoft Learn
    Sep 9, 2025 · This article shows how to use secrets from Azure Key Vault as values in app settings or connection strings for apps created with Azure App ...Grant your app access to a key... · Understand rotation
  53. [53]
    Connect to Azure SQL with Microsoft Entra authentication and ...
    Jun 9, 2025 · This article describes how to connect to Azure SQL data sources by using Microsoft Entra authentication from a .NET application with SqlClient.Overview · Setting Microsoft Entra...
  54. [54]
    Database secrets engine | Vault - HashiCorp Developer
    Configure Vault with the proper plugin and connection information. ... This is necessary for some alternate connection string formats, such as ADO with MSSQL or ...
  55. [55]
    Best practices for protecting secrets | Microsoft Learn
    Aug 30, 2024 · General best practices · Conduct an audit to identify secrets · Avoid hardcoding secrets · Use secure key stores · Implement secret scanning tools.General Best Practices · Avoid Hardcoding Secrets · Service-Specific Best...
  56. [56]
    Configure read-only routing for an Always On availability group
    Mar 15, 2025 · To configure an Always On availability group to support read-only routing in SQL Server, you can use either Transact-SQL or PowerShell.
  57. [57]
    'Keyword not supported: 'trust server certificate'.' - Microsoft Q&A
    Sep 24, 2024 · The error message 'Keyword not supported: 'trust server certificate' usually caused by connection strings. Here is a known thread like yours ...
  58. [58]
  59. [59]
    Connection string builders - ADO.NET Provider for SQL Server
    Jun 25, 2024 · The connection string builder classes are designed to eliminate guesswork and protect against syntax errors and security vulnerabilities.
  60. [60]
    mysql special characters in connection string - Microsoft Q&A
    Dec 22, 2023 · A Visual Studio program using a MySQL connection string with special characters in the password causes an error when passed to the server. The ...Missing: unescaped | Show results with:unescaped
  61. [61]
    OleDbConnection.ConnectionString Property (System.Data.OleDb)
    An invalid connection string argument has been supplied or a required connection string argument has not been supplied. Examples. The following example creates ...Missing: common | Show results with:common
  62. [62]
    Connection to local SQL Server Database Fail - Microsoft Q&A
    Mar 19, 2021 · When I try to use a single "\" in my connection string VS prompts me saying unrecognized escape sequence and won't build. ... What am I missing?
  63. [63]
    A network-related or instance-specific error occurred - SQL Server
    Jan 10, 2025 · You often encounter errors when an incorrect server name is specified in the connection string. Make sure that the server name matches the one ...
  64. [64]
    MSSQLSERVER_4064 - SQL Server - Microsoft Learn
    When you attempt to connect to a database that doesn't exist, you might see the following error message: Cannot open database "AdventureWorks" requested by the ...
  65. [65]
    Troubleshooting connectivity - JDBC Driver for SQL Server
    Jun 25, 2024 · You can check TCP/IP connectivity to SQL Server by using telnet. For example, at the command prompt, type telnet 192.168.0.0 1433 where 192.168.
  66. [66]
    Troubleshoot Common Connection Issues - Azure SQL & SQL ...
    Jun 16, 2025 · Check the application's connection string to make sure it's configured correctly. For example, make sure that the connection string specifies ...
  67. [67]
    MSSQLSERVER_18456 - SQL Server - Microsoft Learn
    May 3, 2024 · To resolve this error, follow these steps: 1. Check if the SQL Server error log contains the error message "Login failed for user '<username>'.Details · Explanation
  68. [68]
    Overview of consistent authentication issues in SQL Server
    Apr 8, 2025 · The explicit SPN account might be wrong, missing, or misplaced. Check whether the SPN is on the wrong account. "Cannot open database <test> ...
  69. [69]
    How to fix, Login failed. The login is from an untrusted domain and ...
    May 12, 2023 · We are getting below error : "Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication."