Unable to connect to SQL Server session database. – sharepoint error

Recently, i faced an issue with a browser based InfoPath form in SharePoint which kept me on my toes for 2 days.

I was getting the following error:-

Unable to connect to SQL Server session database. The connection string (server=’NDHDEVMOSSSQL’, database=’NDHDev_SharedServices_DB’) was returned by an instance of the IPartitionResolver type ‘Microsoft.Office.Server.Administration.SqlSessionStateResolver, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’. at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)

at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo)
at System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean& usePooling)
at System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I found a number of solutions on internet, but none of them worked and later on we found that –

  • The issue was while creating the web application **** credential account was given and the password had expired.
  • So we have to give always service account for each application pool when creating web application for which will teh paswword would not expire.

Other solutions which i tries but didn’t worked were:-
1st:-

1. On SQL Server 2005 Management Studio, below Security – Logins

locate the user that represents your web server, DOMAINMACHINE$.

2. Right-click the DOMAINMACHINE$, choose User Mapping.

3. Map the SharedServices1_DB. check the roles db_owner and public.

4. Click OK and you’re set!

2nd:-
Clsoe all your browsers and clear the browser cache. Somehow the session is getting crashed.

3rd:-
This is due to the hard disk of your sql server is full. remove unnecessary data to free some space.