Lightning Tools Blog

SharePoint Tools, Web Parts and Discussions

Business Connectivity Services and Oracle with BCS Meta Man

In our previous blog posts we have already introduced to you how it is easy to create Business Connectivity Service External Content Types, upscale BDC application definition files and upsize SPD 2010 generated BCS models with BCS Meta Man. All these blog posts were done based off Microsoft SQL server. In this walkthrough we’ll show you how to create a BCS External Content Type, generate C# methods, and make an association for Oracle database tables.

1) Open up Visual Studio 2010 and create a new empty SharePoint project.

Create a empty SharePoint Project

2) Right click on the project and add a new BCS Meta Man item.

Add a new BCS Meta Man project item

3) Add System.Data.OracleClient reference to your project, which is in the following location,

C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.OracleClient.dll.

add System.Data.OracleClient.dll

4) When the BCS Meta Man design surface is in view you will find the BCS Meta Man menu item in the menu bar. Click on BCS Meta Man - > BCS Meta Man Data Source Explorer.

Open BCS Meta Man Data Explorer

5) Click on the “Add Oracle Connection” button of the data source explorer.

Add Oracle Connection

6) In the connection dialog, setup connection to your oracle database.

enter your Oracle connection details

7) If the connection is OK the treeview will populate with Oracle tables.

Treeview populates with Oracle tables

8) Drag and drop the Departments table to the design surface. In the Entity Creation wizard click on the Next button, select to generate all the methods and then click on the Generate button.

Drag and drop an Oracle table onto the design surface

9) BCS Meta Man will add new files to the project which contain generated C# code. You’ll also see the External Content Type on the design surface.

BCS Meta Man generates lots of code for you

10) At this point we have created a BCS external content type for Departments table. Please, do the same to create External Content Type for the Employees table too.

Department and Employee tables from Oracle

11) View the Visual Studio’s toolbox and choose the association action. Create an association between Departments(Source) and Employees(Destination) External Content Types. It will pop up a dialog for identifier mapping. Select DepartmentId in both dropdown boxes.

Set association fields between content types

12) Click on OK and it will create an association between those two tables. You’ll find that it automatically adds a new association method to the Employees External Content Type.

BCS Association created

13) Rebuild the project and press CTRL+F5 to deploy the solution.

14) Go to your SharePoint site and add a new External List. Set either Departments or Employees as the External Content Type to use for the list. We want to make sure, that all the generated methods work properly.

15) When the External List is displayed, it calls the BCS Finder method to populate the records.

BCS External List with Oracle data

16) Click on the Items ribbon which is in the top. If Creator method is configured properly then it should be enabled.

Create new item

17) Click on “New Item” and insert a record.

Add record to Oracle

18) You can see the inserted record in the list.

External List updated

19) Let’s check if the specific finder method works ok. Select any record in the list and go to Items ribbon. Click on View Item button.

Test Specific Finder method

20) “View Item” should execute the specific finder method.

View Item

21) And finally, let’s make sure that updater works properly. Select any item in the list, click on Items ribbon and then click on Edit Item button.

Check updater method

22) Update the name of the selected department and click on Save button.

Update data straight to Oracle

23) When the list is re populated, you’ll see the updated record.

External List updated live

Well, we have made sure that all the generated methods(Finder, Specific Finder, Creator, Updater) work properly, but we have an association between Departments and Employees as well. So, let’s make sure it works ok too.

24) Edit the page of your SharePoint site, add add a BCS List and BCS Related List web part. Set Departments as the type for BCS list web part and Employees as the type for BCS related list web part. Connect those two web parts, so BCS List web part should send data to the Related List web part. Select any department in the list web part. This will execute the association method and populate appropriate employees in the related list web part.

Test Oracle association works

<hrayr/>

Click here to get an email when we update our blog

Print | posted on Thursday, January 21, 2010 4:06 PM

Feedback

# re: Business Connectivity Services and Oracle with BCS Meta Man

left by Nick at 1/28/2010 10:07 AM Gravatar
we have now posted a video of this walk through up as well for you to watch:
http://www.lightningtools.com/blog/archive/2010/01/28/oracle-and-the-business-connectivity-services.aspx

# re: Business Connectivity Services and Oracle with BCS Meta Man

left by Alexander Brütt at 3/26/2010 1:50 PM Gravatar
When I add an Oracle connection I get the following exception:

Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.

My System:

Windows Server 2008 SP2 64 Bit
Visual Studio 2010
SharePoint 2010 64bit
Oracle 11.x 64bit

Do you have any idea what might be wrong?

# re: Business Connectivity Services and Oracle with BCS Meta Man

left by Marc at 7/19/2010 8:18 AM Gravatar
Hi, I am getting the same error upon adding the connection: attempt to load oracle client libraries threw badimageformatexception
I have Windows Server 2008 R2 64 bit.

Is there any solution for it?

# re: Business Connectivity Services and Oracle with BCS Meta Man

left by Grim Deville at 8/18/2010 2:05 PM Gravatar
We get the same as the person above behaviour: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed.
Title  
Name
Email (never displayed)
Url
Comments   
Please add 2 and 4 and type the answer here: