The Web application shows the error message "Cannot connect to database"

Official translation unavailable. Translate this page with Google:

Problem

You connected your web printing solution to your database. When you start the application, it will try to establish a connection and get records from a table.

When running the application you might see the error message, such as:

Cannot connect to database.

Data source name not found and no default driver specified.

kb245-error_message.png

Solution

The application runs in your browser, but if does not connect to the database source directly. There is a service running in the Web Printing site on the server, where you installed NiceLabel Web Printing. The application forwards the data request to the service, which makes a connection to the database.

The Web Printing site uses the application pool EPWebPrintingAppPool to isolate the web application for better security, reliability, and performance. The application pool executes commands using a security account. By default, the security account is predefined to Network Service.

Network Service account causes the error. The service cannot connect to the database.

SOLUTION 1

Allow the security account Network Service the connection to the database.

SOLUTION 2

Change the security account that the application pool uses to access database resources.

  1. Run Internet Information Services (IIS) Manager on the server, where you have installed NiceLabel Web Printing server components (Web Printing site).

  2. In the left navigation pane, expand server_name node, then expand Application Pools.

  3. Right-click the EPWebPrintingAppPool application pool and select Properties.

  4. Go to Identity tab.

  5. Change the security account that the application pool uses. Select the account that Web Printing site can use to get access to the database.