Overview

    If you are running into a database connection error when starting up the POS we have some tips for resolving the issue.


Procedure

Common examples of the error messages you may see are:


"The application was unable to start correctly (0xc0000142).  Click OK to close the application", the caption of the error message will say "sqlservr.exe - Application Error".

"System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible."

"Unexpected exception occurred: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. "


Solutions may include:
  1. Reboot the computer.
  2. Use the SQLLocalDB commands from command line to check on the status of the database server on the POS.
    Run "sqllocaldb info" - this will show all running instances of SQL local DB. you should see an instance called "cr" in the list
    Run "sqllocaldb info cr" and you should see information about that instance.-Shared name should be "shared"-Owner name should be your computer and your windows username-Auto-create should be "no"-State - this should be "Stopped" if Cloud Retailer isn't running and "Running" if it is.Instance pipe name should be empty if the instance is not running, and a path if it is.
    Run "sqllocaldb start cr" to start the localdb instance.
    You can find full documentation on the command line parameters here:https://docs.microsoft.com/en-us/sql/tools/sqllocaldb-utility
  3. Use SQL management studio as a tool to diagnose issues. The connection string is "(localdb)\.\shared"
  4. Make sure the SQL Server VSS Writer service is running.  If it was not, start it, and you may need to / should reboot the computer once more after this step before starting Cloud Retailer POS.  SQL Server VSS Writer is not required strictly speaking but it can resolve connectivity issues on some occasions. 
  5. Make sure the SQL Server Browser service is running.


References