Skip to main content

How to Update an Application's Microsoft SQL Server Connection String

Update the connection string for an application to ensure it can successfully connect to a Microsoft SQL Server database. This process is performed by a customer to update application configuration files after a migration, a server change, or a...

Update the connection string for an application to ensure it can successfully connect to a Microsoft SQL Server database. This process is performed by a customer to update application configuration files after a migration, a server change, or a database credential update.

Before you begin

You will need:

  • Access to the application's configuration files or settings.

  • The correct connection details for the Microsoft SQL Server, including the server address, database name, and the specific credentials (username and password) for the database user.

  • The specific connection string format required by your application (e.g., .NET, PHP, or a specific CMS).

Update the connection string

  1. Locate the configuration file for your application. Common locations include web.config, app.config, or a specific configuration file provided by your CMS or application framework.

  2. Open the file in a text editor or through your application's management interface.

  3. Locate the connection string section. It typically begins with a tag such as <connectionStrings> or a variable like DB_CONNECTION_STRING.

  4. Identify the specific connection string for the Microsoft SQL Server database.

  5. Update the following components within the connection string:

    • Data Source (or Server): Replace the old server address with the current server address (e.g., 192.0.2.10 or sql.example.com).

    • Initial Catalog (or Database): Ensure the correct database name is specified.

    • User ID: Update to the current database username.

    • Password: Update to the current password for that user.

  6. If your application requires a specific port, ensure it is included in the Data Source (e.g., 192.0.2.10,1433).

  7. Save the changes to the configuration file.

  8. Restart the application or the web service if required by your specific platform to apply the changes.

Confirm the result

  • The application loads successfully and displays the expected content.

  • The application can perform database-dependent actions, such as logging in, retrieving data, or submitting forms.

  • You can verify the connection by attempting to log in to the application's administrative area.

Troubleshooting

Connection fails after update

If the application fails to connect after you have updated the string, verify the following:

  • Credentials: Ensure the username and password are correct and that the user has permissions to access the specific database.

  • Server Address: Confirm that the server address is reachable from the application's environment.

  • Port Access: If you are using a non-standard port, ensure that the port is open and not blocked by a firewall.

  • Syntax: Ensure there are no extra spaces or missing quotes in the connection string.

Limitations

This procedure does not include instructions for creating new database users or changing permissions within the Microsoft SQL Server itself. If you need to change the underlying database permissions, contact Hostek support or your database administrator.

Did this answer your question?