Editor's Note: The following MVP Monday post is by SharePoint MVP Destin Joy
SharePoint 2010 External Content Type to read data from SQL Server using SQL Authentication and
Secure Store Service
Most of the articles on BCS are explaining about reading data from database using windows authentication.
Windows authentication to read data from database won’t work in many of the scenarios. We have to use
SQL authentication to read or manipulate data from SQL. We have to use secure Store Service to use
SQL authentication
Here we have following five steps to achieve the same
- Create a dummy table
- Configure Secure Store Service
- Configure BCS service
- Creating External Content type.
- Creating External List
- Before starting, you should have an SQL server Table. I have created a database with name
Contact List. - Right click Table tab of the Contact_List and click on New Table
- I have created a table with the below fields and saved the table with the name Contact_Table
No |
Field Name |
Type |
1 |
Name |
nchar(10) |
2 |
Address |
nchar(10) |
3 |
Phone |
nchar(10) |
4. Now go to your central Administration Screen. Click on application management an select
Manage Services from Service Applications
Configuring Secure Service Store
5. From the list of service applications select Secure Store Service
6. Click on Generate New Key tab from the top
7. Give a Pass Phrase and confirm the Phrase
8. Click on the new from the ribbon once you done with key generation
9. In the next screen give the below details.
No |
Options |
Value |
1 |
Target Application ID |
Any Name |
2 |
Display Name |
Any Name |
3 |
Contact Email |
Any Email |
4 |
Target Application |
Individual |
10. Click Next. In the screen you got, give the details as shown below
11. Please note, to select Username and password from the filed type
12. Once done with details, click Next
13. Give service account name in the screen and give permission for the user to edit the details if needed later
14. We have almost done with Secure Service Store. Click on the menu SQL_BCS and select set Credentials from the menu
15. Give credentials Owner .SQL user name and password to retrieve the data from SQL
Creating
External Content Type
16. Hopes you already have a web application, where we can create external content type.
17. Open your web application in SharePoint designer, Select External Content type from the ribbon
18. Once opened in SharePoint Designer Click on External Content as shown below
19. Give proper name and display name, I have given BCS_Contacts
20. Select Office item type if you want to integrate the same data with Out look
21. Click on “Click here to discover external data source and define operations” link from External System
22. You will get the below screen, click on Add connections. Please note, to select the last option
23. In the screen Give the below screen. Give below details
No |
Options |
Value |
1 |
Database Server Name |
Your database server name or IP |
2 |
Database r Name |
Your database name |
3 |
Name |
Any Name |
4 |
Connect with impersonated Custom Identity |
The Secure Store Service name we created in first step |
24. You will be prompted with the user name and password. Give the same we entered to connect to SQL server
database
25. You will get the below screen populated with the database details
26. Right click on the Table and select Create all operations if you want to do all the operations in the database.
27. You will be prompted with the below scree
28. Click Next
29. If you want to add any filter add the same from the below screen.
30. Click Save the BCS from the top
31. Go to manages services and select Business Connectivity service then click Administration
32. Give the ID of the user who can use this service
33. Then click on permission and give permission to who all need to use this service
34. Click on the Secure Store Service ,select the metadata store permission from the ribbon
35. Give permission to all the users who want to use this service to read data from the data base
Creating External List
36. Click on View all site content from your web application
37. Click on create
38. Select External list from the menu
39. Give proper name and click Create
40. Give the name for the External content type and select the externalcontent Type external
Content Type as the one we created using designer. Click Create
41. You can see your list populated with the data from database
Author's Bio
Destin Joy is a Microsoft MVP on SharePoint Server. He is |