Connection String

A connection string is a string of characters that provides necessary information and parameters to establish a connection between a software application and the database. Connection strings are considered sensitive information and we recommend handling them securely, such as by avoiding hardcoding the string into the application’s code or configuration files.

Connection strings contain key-value pairs that specify the location, credentials, and configuration settings needed to connect to data within the database. For example, a connection string could include the server address, port number, database name, usernames and passwords used to connect to the database.

Connection strings help the application understand specific protocols or software required to interact with the data source. These strings can contain additional configuration settings that customize the behavior of the connection, such as controlling security protocols, connection pooling, or other connection-related parameters.

All DigitalOcean Managed Databases are accessed using connection strings.

Format and Syntax

The format and syntax for connection strings vary depending on the data source and the data access technology used. Different providers and drivers have their own requirements and conventions for connection string syntax. For example, the key-value pairs of a connection string may be separated by semicolons or other delimiters or special characters.

SQL Server Connection String
Server=<your-server-address>;Database=<your-database>;User Id=<your-username>;Password=<your-password>;
MySQL Connection String
Server=<your-server-address>;Port=25060;Database=<your-database>;Uid=<your-username>;Pwd=<your-password>;

Connection String Articles

Deploy your source onto App Platform with a “Deploy to DigitalOcean” button in your source repository.