Business Data Catalog and yet another battle of Database Connections

Some time ago, I wrote a web part that retrieves data via the Business Data Catalog from the AdventureWorks SQL Server database. I wrote an application definition file and loaded it into the Business Data Catalog. This application file specifies a certain number of methods to retrieve departments and to retrieve employees from a specific department.

Then I developed a web part that makes use of the BDC Object Model to retrieve the data. The web part looks as follows:

BDC webpart

The webpart works fine when I was logged on as adminstrator but when I signed in as a different user with less permissions, that webpart returned the exception "Access denied by BDC". While debugging the webpart code, I found out that the webpart correctly retrieved the metadata from the Business Data Catalog, i.e. the Lob system instance, the entity and the method instance, but that it failed when executing the Execute method of the entity, which does the real data retrieval from the SQL Server database.

To solve this problem, I had to set permissions in the Shared Services Provider via Central Administration.

BDC permissions