SQL Connection Error

Jan 5, 2012 at 8:02 PM

Seeing this error repeatedly in the servicebus.messagestore.errorLog.txt.  Am I missing a configuration somewhere?

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. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
   at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at Phoenix.DataAccess.Database.get_Connection()
   at Phoenix.DataAccess.Database.<>c__DisplayClass14.<Execute>b__13()
   at Phoenix.DataAccess.Database.DoWork[TReturn](Func`1 func)
   at Phoenix.DataAccess.Database.Execute(String query)
   at Phoenix.DataAccess.Database.BuildTableSchema()
   at Phoenix.DataAccess.Database..ctor(String connectionString, Boolean useTransaction)
   at Phoenix.DataAccess.Model.get_Database()
   at Phoenix.DataAccess.Model.Dispose()
   at Phoenix.DataAccess.Model.Execute(Action`1 action, String connectionString, Boolean useTransaction)
   at PServiceBus.MessageStorages.DefaultSentMessageStorage.SaveMessage(SentMessage message, String address) in C:\Users\rpgmaker\Desktop\pServiceBus\pServiceBus 1.0.2\Src\PServiceBus.MessageStorages\DefaultSentMessageStorage.cs:line 34
   at PServiceBus.MessageStorages.DefaultSentMessageStorage.<>c__DisplayClass2.<Store>b__0() in C:\Users\rpgmaker\Desktop\pServiceBus\pServiceBus 1.0.2\Src\PServiceBus.MessageStorages\DefaultSentMessageStorage.cs:line 22
   at PServiceBus.Core.Runtime.MethodHelper.TryCatch(Action action) in C:\Users\rpgmaker\Desktop\pServiceBus\pServiceBus 1.0.2\Src\PServiceBus.Core\Runtime\MethodHelper.cs:line 18

Jan 5, 2012 at 8:45 PM
Edited Jan 5, 2012 at 8:46 PM

The reason you are getting the error is because the configuration file for the instance is defaulted to the following, which is expecting a sql server express edition running on the machine you installed it. 

 <add name="default" type="PServiceBus.MessageStores.DefaultMessageStore" address="Server=.\SQLExpress;Database=servicebus;Trusted_Connection=yes;MultipleActiveResultSets=True"/>

You need to navigate to the folder where you install the service bus and look for the ESB folder in which you will edit the app.config file

You will need to update the address attribute to match your mssql database server and also make sure you run all the scripts(Src\PServiceBus.Data.Entities\Scripts\SentMessageStorage.sql) on the database server if you are using 1.02 else if you are using the current branch(2.0.0) you just need to make sure you give create table permission on the login you setup for your database


Once you are done, you will need to restart the PServiceBus.MessageStore service and you are good to go :)



I will post this instruction in the documentation area for other people that might be getting the same problem.

Jan 5, 2012 at 8:50 PM
Edited Jan 5, 2012 at 11:04 PM

Btw, thanks for discovering this problem

Jan 9, 2012 at 8:42 PM

I ran the SQL script embedded in documentation (Word Doc) but it appears to be the wrong version because I'm seeing the following error:

System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'TopicID'.
Invalid column name 'TopicName'.
Invalid column name 'ESBMessageID'.
I don't see the download for version 1.0.2 so I can't find the appropriate script.  Any help would be appreciated.
Jan 9, 2012 at 9:50 PM
Edited Jan 9, 2012 at 9:51 PM

You can navigate to the link below and click download for the changeset which includes the 1.0.2 scripts



Sorry that i removed the 1.0.2 src from the changeset

Jan 9, 2012 at 9:54 PM

I have added the database script to the download page for release 1.0.2


Jan 10, 2012 at 1:39 PM

That worked...thanks for your help.

Jan 10, 2012 at 1:44 PM

No problem. By the way, you know you can create your own custom message storage plugin dll and construct your database or any storage you wish the way you want. If you do want to create one, you can refer to the implementation of the defaultMessageStorage code and once you have your dll; drop it in the bin folder of the installation and update the config to point to your implementation