If you are using SharePoint 2010 RTM and get the following error:
Access denied by Business Data Connectivity.
It likely is because by default on installation the BCS service doesn't have any permissions
enabled at all.
If you go to your central administration site and manage the BCS service and look
at Metadata Store permissions you'll see that it is empty
Obviously in a production environment you want to be very deliberate about setting
the permissions, but when you are developing you just want your code to work :)
Here's a PowerShell script that will set the permissions on the Metadata store (and
all BCS models deployed after you run the script) to all windows users. Again,
not something I recommend for a production machine - but something that is fine for
your development machine.
Tools\Web Server Extensions\14.0\WSS\"
= Get-Item $adminURL
">Central admin site "+ $adminurl
Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Updating BCS persmissions
= Get-SPBusinessDataCatalogMetadataObject -BdcObjectType Catalog -ServiceContext $adminurl
= New-SPClaimsPrincipal -Identity 'c:0!.s|windows' -IdentityType
-Identity $obj -Principal $claim -Right $right