State Service Error while working with WorkFlow


Encountered the following error while running an OOB Workflow on the customer environment.

"Microsoft SharePoint Server State Service encountered an error executing a stored procedure for database key <>  Details: Cannot open database "StateService_" requested by the login. The login failed.  Login failed for user 'XXX'.  

The error has nothing to do with enabling Session state for SharePoint. The workflow uses infopath forms which inturn uses the State Service Application ( in CA ) to store the user details .

  • Check for the database, if it exists on the database server.
  • If the database exists , provide the user in question with necessary access right.
  • If the database does not exist, then run 'New-SPStateServiceDatabase' command with database and service application application option.
  • Check that the new database is created.
  • Provide access to user in question on the database...