Update Database Connection Strings

Full line of Dedicated Servers with managed care available

Update Database Connection Strings

There are many different ways to update a database connection.  The method used to connect to your database will vary based on the type of programming language, type of database and security settings. All connection strings will have certain variables that will need to be updated whenever you change your database server, username or password.


Variables

Each database connection string will have the same following variables that will need to be adjusted in the event of a change:

Whatever method you are using to connect to your database the connection string will still have the same following variables:
  • Database Server Name
  • Database Name
  • Username 
  • Password
While your connection string may not look exactly like this, a typical connection string will look similar to one of the following:

MySQL:

"Provider=MySQLProv;Data Source=Your_MySQL_Database;User Id=Your_Username; Password=Your_Password;"

MSSQL:

"Data Source=Your_Server_Name;Initial Catalog= Your_Database_Name;UserId=Your_Username;Password=Your_Password;"

OR

"Server=Your_Server_Name;Database=Your_Database_Name;UserID=Your_Username;Password=Your_Password;Trusted_Connection=False"


Connection String VS. Datasource


A datasource is a database connection that is defined inside the WebControlCenter or Plesk rather than lines of programming code inside something like your web.config file or in lines of your code.  Once a datasource is defined instead of having the connection coded directly, you will refer to the datasource instead. 

Use the appropriate instructions below to setup a datasource:

  1. WebControlCenter Datasource Setup
  2. Plesk Datasource Setup



WebControlCenter Datasource Setup


First you will need to log into the WebControlCenter by going to the WebControlCenter Login Page

Next navigate to Database > Datasource Admin.



Select the type of database you use on your site from the drop down menu.



Enter the name you would like to use for your datasource.


Select the database you would like your datasource to connect to.


Select the username that you would like to use to connect to your database.



Click Save


Once the datasource has been created you will need to click test it to get the datasource that you will need to add to your code.



Once the datasource has been saved the WebControlCenter will pull your password on file and setup your connection string for you like the example below:



Please Note: In certain circumstances, like with ColdFusion, you will not need to specify the password as that information will be stored on the server itself.


Plesk
Datasource Setup



First you will need to log into Plesk by going to domain.com/plesk (where domain.com is your domain) or going to the Plesk Login Page.

Once logged in navigate to the Websites & Domains tab.



Next open Advanced Operations.



Find ODBC Data Sources in the Lower Left Corner of Advanced Operations.




Click Add New ODBC DSN.



Enter a name and description (optional) for your datasource.  Then select the type of database that you will be connecting to from the drop down menu.



Click OK.


Add Feedback