You are here: Home / FAQ / Database / Error during eWay-CRM start when you are using LocalDB

Error during eWay-CRM start when you are using LocalDB

Description

You can see this error when you are launching eWay-CRM and you are using LocalDB to connect to the eWay-CRM database:

*** EXCEPTION ***
Hash: 11819C934E56127E51EE3D1C0DCB8CA1
Message: System.Data.SqlClient.SqlException: 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. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server.)
v System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
v System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
v System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
v System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
v System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
v System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
v System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
v System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
v System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
v System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
v System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
v System.Data.SqlClient.SqlConnection.Open()
v eWay.Core.MSSQLDataInterface.MSSQLItemStore.get_Connection()
v eWay.Core.MSSQLDataInterface.MSSQLItemStore.CreateStoreAndCheckConnection(String connectionString, Boolean useMasterDatabase)
v eWay.Core.Data.DataStorage.CheckConnectionToServer()
v eWay.Core.Data.DataStorage.TryConnectionToServer(Int32 maxRetryCount)
v eWay.Core.Office.Addins.OutlookAddin.Connect.<>c__DisplayClass4c.<CheckSqlService>b__4b(IProgressReporter reporter)
v eWay.Core.GUI.Dialogs.BackgroundWorkerProgressDialog.OnDoWork(ProgressDoWorkAction doWork)
v eWay.Core.GUI.Dialogs.BackgroundWorkerProgressDialog.<>c__DisplayClass4.<.ctor>b__0(Object workerSender, DoWorkEventArgs workerArgs)
v System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
v eWay.Core.Threading.PlainBackgroundWorker.OnDoWork(DoWorkEventArgs e)
v eWay.Core.Threading.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
v System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
TargetSite: Void OnError(System.Data.SqlClient.SqlException, Boolean)
Source: .Net SqlClient Data Provider
StackTrace:
v System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
v System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
v System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
v System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
v System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
v System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
v System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
v System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
v System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
v System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
v System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
v System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
v System.Data.SqlClient.SqlConnection.Open()
v eWay.Core.MSSQLDataInterface.MSSQLItemStore.get_Connection()
v eWay.Core.MSSQLDataInterface.MSSQLItemStore.CreateStoreAndCheckConnection(String connectionString, Boolean useMasterDatabase)
v eWay.Core.Data.DataStorage.CheckConnectionToServer()
v eWay.Core.Data.DataStorage.TryConnectionToServer(Int32 maxRetryCount)
v eWay.Core.Office.Addins.OutlookAddin.Connect.<>c__DisplayClass4c.<CheckSqlService>b__4b(IProgressReporter reporter)
v eWay.Core.GUI.Dialogs.BackgroundWorkerProgressDialog.OnDoWork(ProgressDoWorkAction doWork)
v eWay.Core.GUI.Dialogs.BackgroundWorkerProgressDialog.<>c__DisplayClass4.<.ctor>b__0(Object workerSender, DoWorkEventArgs workerArgs)
v System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
v eWay.Core.Threading.PlainBackgroundWorker.OnDoWork(DoWorkEventArgs e)
v eWay.Core.Threading.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
v System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Version

All versions of eWay-CRM

Difficulty

High

Resolution

It is impossible to connect to the (localdb)/EWAYSQL instance, so you need to delete it at first by this command:

sqllocaldb delete EWAYSQL

When the instance is deleted, use this command to create the new one:

sqllocaldb create EWAYSQL

Then, you need to connect the database using SQL Management Studio or our application QueryExPlus which is in the installation folder. Use this command to create a connection ("user1_dbid" will be different due to specific user):

EXEC sp_attach_db @dbname = N'eWay_user1_dbid',
@filename1 =
N'C:\Users\User1\eWay_user1_dbid.mdf',
@filename2 =
N'C:\Users\User1\eWay_user1_dbid_log.ldf';