WebPart connection to SQL Server

Hi,

We are connecting webpart to a external SQL Server Database through a Windows Authentication. We are unable to connect this from a SharePoint and get an error, "Login failed for user 'NTAUTHORITY\ANONYMOUS LOGON".

But while we connect from a Windows Form Application, We are able to connect to the Database

Any Ideas of how to establish connection between webpart and external sql server database.

June 26th, 2015 5:00pm

Hi Sam,

From your description, my understanding is that you get error when you connect to external sql server database.

Please try to use SPSecurity.RunWithElevatedPrivileges(delegate()) method in your code, here is a similar case for your reference:

https://social.msdn.microsoft.com/Forums/office/en-US/abb17c3d-0821-415b-bc96-b5559c52cf5a/call-sql-connection-in-visual-webpart?forum=sharepointdevelopment

Best Regards,

Vincent Han

Free Windows Admin Tool Kit Click here and download it now
June 29th, 2015 2:27am

Sounds like delegation to me. 
June 29th, 2015 3:33am

We are trying to connect to External Database through Sharepoint via Windows Authentication "DOMAIN\NetworkID". This is because, we need to start a job in SQL Server using Windows Authentication.

But we are unable to establish the connection using "DOMAIN\NetworkID", but we will be able to connect using SQL Authentication. We do tried with a sample .NET Application for connectivity which worked.



Free Windows Admin Tool Kit Click here and download it now
June 29th, 2015 11:58am

Use External Content Type. So that you can use BCS service to display SQL data in your web part

https://msdn.microsoft.com/en-us/library/office/ee556391%28v=office.14%29.aspx?f=255&MSPPError=-2147217396
June 30th, 2015 12:48am

Thanks Sundar, Will try this...

Just want to confirm whether we can execute a Stored Procedure in the External SQL Server using the External Content Type?

Free Windows Admin Tool Kit Click here and download it now
June 30th, 2015 3:46pm

Hi Sam,

  This may helps you http://karthickmicrosoft.blogspot.in/2011/04/using-external-content-types-with.html
July 1st, 2015 3:29am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics