MOSS Forum

Ask Question   UnAnswered
Home » Forum » MOSS       RSS Feeds

Error executed during connection to SQL database

  Asked By: Michael    Date: Nov 30    Category: MOSS    Views: 795

I am solving this problem: I am developing webPart (Visual Studio 2008) and I
want to connect to the SQL database (2008) but somehow I get this error at
SharePoint site (2007):
Login failed for user 'umsreader'.

Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error
and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user

Source Error:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.

When I use Widows authentication I also can't connect to the database. But when
I create ordinary Web application everything work fine, just when I use this at
Web part at Sharepoint.

I tried change web.config, but it is still the same. I really don't know where
problem could be



2 Answers Found

Answer #1    Answered By: Leeann Hull     Answered On: Nov 30

Did you create user account in SQL????????????

Answer #2    Answered By: Vaasu Radhakrishna     Answered On: Nov 30

You can't impersonate the logged in user in SharePoint to the SQL server
unless you are using Kerberos. The normal workaround is to put the actual
connection code inside a RunWithElevatedPriveledges delegate. That way the
code runs in the security context of the AppPool Identity for the Web
application. Make sure the app pool identity account is a valid user in SQL
also. The only code that really needs to be in the delegate would be the
call to the dataadapter.fill method.

You can read more about RunWithElevatedPriveledges here:


Didn't find what you were looking for? Find more on Error executed during connection to SQL database Or get search suggestion and latest updates.