Connecting to SQL Server Database


Having created a new SQL database, you need to modify the Web.config file so that the Cartella instance can connect to the database. The following steps explain how to do this.

To connect to the new SQL Server database:
  1. Navigate to the Cartella site folder (e.g., [Site_Root]).
  2. Open the Web.config file with a text editor or IDE.
  3. Scroll to the <connectionStrings> node.
  4. Above <connectionStrings>, find the commented area containing examples of the three connection strings that need to be configured:
  5. Copy those connection strings to just below the <clear> node.
    <connectionStrings>
        <clear/>
        <add name="MSSQL2005"
            connectionString="Data Source=SERVER/SQL_SERVER_INSTANCE_NAME; 
            Initial Catalog=NEW_DB_NAME; 
            User Id=CARTELLA_DB_USER_ACCOUNT; 
            Password=CARTELLA_DB_USER_PASSWORD;"
            providerName="Cartella.Classes.MSSQLObjectProcedureEngine"/>
        <add name="MSSQL2005_Asset"
            connectionString="Data Source=SERVER/SQL_SERVER_INSTANCE_NAME;
            Initial Catalog=NEW_DB_NAME;
            User Id= CARTELLA_DB_USER_ACCOUNT;
            Password=CARTELLA_DB_USER_PASSWORD;"
            providerName="Cartella.MSSQLProcedures.MSSQLAssetProcedureCollection"/>
        <add name="Elmah.Sql"
            connectionString="Data Source=SERVER/SQL_SERVER_INSTANCE_NAME;
            Initial Catalog=NEW_DB_NAME;
            User Id=CARTELLA_DB_USER_ACCOUNT;
            Password=CARTELLA_DB_USER_PASSWORD;"/>
    </connectionStrings>
  6. Complete the following steps for each of the three connection strings.
    1. Edit <SQL Server Location>\<Database instance> to point to your SQL server location and SQL instance. (The server name must resolve to the IP address that was used to create your license key.) You may also enter an IP address instead of a server name.
    2. Enter the new database name as the @Initial Catalog assignment. That is, replace @New_DB_Name with the name of the new database.
    3. Enter the user ID and password for the administrator, replacing CARTELLA_DB_USER_ACCOUNT and CARTELLA_DB_USER_PASSWORD, respectively.
      Note
      Alternatively, the Windows credentials used by the website's application pool can be added to SQL. In this case, there would be no user name and password. Instead, add the attribute: Integrated Security="true".
    Example:

  7. When you're finished modifying Web.config, save the file and exit the editor.

Next Steps: After setting up the connection from Cartella to your SQL Server database, you can now log into your new instance of Cartella.