Accessing Databases with Connection Strings

Another method of connecting to a database is using a connection string. A connection string is a string that contains information about a data source (usually a database engine), as well as the information necessary to connect to it. While the exact syntax of a connection string varies depending on the data source (for example, a connection string meant to connect to a MySQL database server will look different than one for a PostgreSQL server), you will usually be required to specify the following data:

  • Database server address. To find out your database server address do the following:
    1. Go to Websites & Domains and click Databases.
    2. Click the Webadmin link for one of your databases.
    3. At the top of the screen look for an entry of the following form "Server: 10.58.103.102:3306". In this example, ‘10.58.103.102’ is the database server address. If the server name is specified like ‘localhost’, contact your hosting provider to find out your database server address.
  • Database name. To find out the exact name of your database, go to Websites & Domains and click Databases to see the list of your databases.
  • Database user login and password. To find out the login of the database user, do the following:
    1. Go to Websites & Domains and click Databases.
    2. Note the name in the Users column next to the database to which you want to connect using the connection string.

    If you do not remember the user’s password, you can reset it. To reset the user’s password, do the following:

    1. Go to Websites & Domains and click Databases.
    2. Click User Management and click the corresponding name in the Name column.
    3. Type in the new password and confirm it. Click OK.

This document does not aim to provide an in-depth description of connection strings’ syntax. If you want to learn more about the subject, we recommend that you visit https://msdn.microsoft.com/en-us/library/windows/desktop/ms722656%28v=vs.85%29.aspx for more information.