Sending StreamInsight Events to a Windows Form Dashboard (Code Included)

Sending StreamInsight Events to a Windows Form Dashboard (Code Included)

I get tired of showing Microsoft StreamInsight demos where my (complex) events get emitted to a console.  So, as part of a recent demonstration, I built a simple Windows Form dashboard that receives events and uses the built-in Windows Form Charting Controls to display the results.  In this post, I’ll show you the full solution […]
Blog Post by: Richard Seroter

Table Operation on Oracle 11g XE with OracleDbBinding

Table Operation on Oracle 11g XE with OracleDbBinding

Last year I did a post on table operations on SQL Server Table with WCF-SQL Adapter from BizTalk on SQL. Now I like to do similar thing on table in Oracle 11g Express database using the Oracle Binding from BizTalk Adapter Pack 2010. Oracle 11g Express Edition is available through OTN. For downloading software you will need to have an account!

It is important that when accessing Oracle you have appropriate client installed. This can sometimes be a hassle if you do not know, which client you need. When you trying to connect to Oracle you will get error messages like:

Connecting to the LOB system has failed.

Could not load file or assembly ‘Oracle.DataAccess, Version=2.111.7.0, Culture=neutral, PublicKeyToken=89b483f429c47342’ or one of its dependencies. The system cannot find the file specified..

This can be pretty annoying, but there is documentation that can help you going the right direction. In installation documentation I read that supported versions are:

  • Oracle database version 11.1,
  • Oracle database version 10.2,
  • Oracle database version 10.1,
  • Oracle database version 9.2

And supported client versions:

  • Oracle Data Access Components for Oracle Client 11.1.0.6 with Patch Set 11.1.0.7,
  • Oracle Data Access Components for Oracle Client 11.1.0.7

Installing Oracle 11g Client Release 2

I basically need the Oracle 11g client and I downloaded the latest release 2 version. I installed the Oracle 11g XE and installed the 11g client release 2. The following steps describe the process of installation. First click setup in client folder after having unzipped the win32_11gR2_client.rar file.

1. Install InstantClient

Select InstantClient and click Next.

2. Install InstantClient Location

Select location to install the client and click next.

3. Installation InstantClient Summary

You’ll be presented a summary of selected options. You can click finish.

4. Installation InstantClient Install Product

Installation of Oracle client will start.

5. Installation InstantClient Install Finish

When installation is finished you can click close. To verify if the Oracle.Database Assembly is present view the assembly cache.

6. Oracle Client GAC

As you can see I installed the x86 client and have the appropriate assemblies version 2.112.2.0.

BizTalk Project and generate schema (’s)

First, we need the XML schemas, which represent our data source. With proper installation of BizTalk Server 2010 Adapter Pack (see my post on its installation), you will have a metadata browser built into Visual Studio. NET at your disposal. Create a visual studio BizTalk project. Then you can access the metadata browser from a BizTalk project by right-clicking the project, choosing Add then Generated Items and selecting Consume Adapter Service.

image

Click Add. This action opens a new window that provides us the interface to connect to, browse, and select database objects for service interaction. The very first thing we need to do here is choose the oracleDBBinding as the service binding, and then configure a connection string. The simplest working connection string consists of an Initial Catalog value for the database, and a valid Server name entry. Note that the adapter now uses a connection string in the form of a URI instead of the traditional Data Source=;Initial_Catalog=;User_ Id=;Password= style.

7. Configure Adapter

Once a satisfactory connection string is defined, the Connect button can be clicked to establish an active connection to the target database. If the connection is successful, one see the category browser with a set of database object categories.

image

On the root “/” character a range of un-typed generic functions are displayed, which can be exploited. Click on tables and you will see a number of Tables, select Employee.

image

Click the Delete, Insert, Select and Update statement in available categories and operations. Click the Add button to add the operations.After clicking the Ok button at the bottom, schema (and a single binding file) is added to our associated BizTalk project in Visual Studio.NET.

image

The binding can be used later, when solution is deployed and ports have to be configured for Oracle 11g Express (i.e. Send Port).

Create message instances

Next step is to generate messages from generated schema, which can be routed from Recieve location in Receive Port to a send port with WCF-OracleDb Adapter (messaging based solution). Generating the messages is easy, by opening first OracleDBBindingHR.Table.EMPLOYEES.xsd in file-editor you can move the desired operation to top, so you can then in Visual Studio generate the next instance for an operation or you can use XML-Editor inside Visual Studio (closing schema, right click and select open with and then select XML Editor) to move elements around. In end you will have four xml instance for TableOperations, save to file as xml (type all files, encoding UTF-8!).

Select

<ns0:Select xmlns:ns0=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<ns0:COLUMN_NAMES>COLUMN_NAMES_0</ns0:COLUMN_NAMES>
<ns0:FILTER>FILTER_0</ns0:FILTER>
</ns0:Select>

Update

<ns0:Update xmlns:ns0=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<ns0:RECORDSET>
<ns0:EMPLOYEE_ID>70</ns0:EMPLOYEE_ID>
<ns0:FIRST_NAME>FIRST_NAMEFIRST_NAME</ns0:FIRST_NAME>
<ns0:LAST_NAME>LAST_NAMELAST_NAMELAST_NA</ns0:LAST_NAME>
<ns0:EMAIL>EMAILEMAILEMAILEMAILEMAIL</ns0:EMAIL>
<ns0:PHONE_NUMBER>PHONE_NUMBERPHONE_NU</ns0:PHONE_NUMBER>
<ns0:HIRE_DATE>1999-05-31T13:20:00.000-05:00</ns0:HIRE_DATE>
<ns0:JOB_ID>JOB_IDJOB_</ns0:JOB_ID>
<ns0:SALARY>4</ns0:SALARY>
<ns0:COMMISSION_PCT>32</ns0:COMMISSION_PCT>
<ns0:MANAGER_ID>2</ns0:MANAGER_ID>
<ns0:DEPARTMENT_ID>81</ns0:DEPARTMENT_ID>
</ns0:RECORDSET>
<ns0:FILTER>FILTER_0</ns0:FILTER>
</ns0:Update>

Insert

<ns0:Insert xmlns:ns0=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<ns0:RECORDSET>
<ns0:EMPLOYEESRECORDINSERT>
<ns0:EMPLOYEE_ID InlineValue=”InlineValue_0″>10.4</ns0:EMPLOYEE_ID>
<ns0:FIRST_NAME InlineValue=”InlineValue_0″>FIRST_NAME_0</ns0:FIRST_NAME>
<ns0:LAST_NAME InlineValue=”InlineValue_0″>LAST_NAME_0</ns0:LAST_NAME>
<ns0:EMAIL InlineValue=”InlineValue_0″>EMAIL_0</ns0:EMAIL>
<ns0:PHONE_NUMBER InlineValue=”InlineValue_0″>PHONE_NUMBER_0</ns0:PHONE_NUMBER>
<ns0:HIRE_DATE InlineValue=”InlineValue_0″>1999-05-31T13:20:00.000-05:00</ns0:HIRE_DATE>
<ns0:JOB_ID InlineValue=”InlineValue_0″>JOB_ID_0</ns0:JOB_ID>
<ns0:SALARY InlineValue=”InlineValue_0″>10.4</ns0:SALARY>
<ns0:COMMISSION_PCT InlineValue=”InlineValue_0″>10.4</ns0:COMMISSION_PCT>
<ns0:MANAGER_ID InlineValue=”InlineValue_0″>10.4</ns0:MANAGER_ID>
<ns0:DEPARTMENT_ID InlineValue=”InlineValue_0″>10.4</ns0:DEPARTMENT_ID>
</ns0:EMPLOYEESRECORDINSERT>
</ns0:RECORDSET>
<ns0:COLUMN_NAMES>COLUMN_NAMES_0</ns0:COLUMN_NAMES>
<ns0:QUERY>QUERY_0</ns0:QUERY>
</ns0:Insert>

Delete

<ns0:Delete xmlns:ns0=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<ns0:FILTER>FILTER_0</ns0:FILTER>
</ns0:Delete>

Build and deploy the BizTalk project

Only schemas are required for a messaging only scenario with WCF-Oracle Adapter to perform operations on Oracle 11g XE database. Therefore after assigning a strong name and application name to BizTalk project it can be build and deployed.

image

Configure the application

After solution has been deployed it is time to configure the ports. FILE ports are easy and focus here will be configuring the WCF-Oracle Send Port. Through BizTalk Management Console one can browse to OracleTableOperations application and right click the application and select Import Bindings and navigate to file called WcfSendPort_OracleDBBinding_Custom.bindinginfo.xml, select and click Open. You will notice that a Send Port will be created automatically.

image

If you look at created send port and configuration you will notice that everything is there. Although having all operations in one action mapping is not going to work. If you try to send message with select statement to BizTalk you will get following error:

The adapter failed to transmit message going to send port “WcfSendPort_OracleDBBinding_HR_Table_EMPLOYEES_Custom” with URL “oracledb://win-8bpntqktj5m:1521/XE/Dedicated”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.InvalidOperationException: An action mapping was defined but BTS.Operation was not found in the message context.

Reason that this error appears is that an action header consisting of four actions is not clear to system. It cannot determine which one the appropriate one was. So taking it down to a one line/action declaration corrected the problem.I had to create three similar send ports based on first generated send port. Other step is setting filters on WCF-Send Port and File Send Port. Configuration is as follows:

Port Name Type Filter
RecvPortOracleOpsIn FILE None
SendPortOracleOpsOut FILE

BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#SelectResponse
Or
BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#InsertResponse
Or
BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#UpdateResponse
Or
BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#DeleteResponse

WcfSendPort_OracleDBBinding_HR_Table_EMPLOYEES_Custom WCF-Custom BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#Select
WCFSndPort_OracleDBBinding_HR_TABLE_INSERT WCF-Custom BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#Insert
WCFSndPort_OracleDBBinding_HR_TABLE_UPDATE WCF-Custom BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#Update
WCFSndPort_OracleDBBinding_HR_TABLE_DELETE WCF-Custom BTS.MessageType == http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES#Delete

Next error I ran into was the following, when I tried testing with SelectStatement message:

The adapter failed to transmit message going to send port “WcfSendPort_OracleDBBinding_HR_Table_EMPLOYEES_Custom” with URL “oracledb://win-8bpntqktj5m:1521/XE/Dedicated”. It will be retransmitted after the retry interval specified for this Send Port. Details:”Microsoft.ServiceModel.Channels.Common.MetadataException: Metadata resolution failed for OperationId: “http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES/Select”. —> Microsoft.ServiceModel.Channels.Common.ConnectionException: Due to an Oracle Client limitation, the adapter failed to open a connection. This is because either (a) ambient transaction is present and the TNS alias is longer than 39 characters, or (b) ambient transaction is present and a non-TNS based URI was used. To resolve this, use a TNS alias to connect to Oracle and make sure it is not more than 39 characters.

To resolve this error I had to change the following properties in the oracleDBbinding:

  • “enableBizTalkCompatibilityMode” = True (for some reasons this i set to false per default)
  • “useAmbientTransaction” = False

I also like to note that format of filter for instance in select statement has to be correct or you will run into this error:

The adapter failed to transmit message going to send port “WcfSendPort_OracleDBBinding_HR_Table_EMPLOYEES_Custom” with URL “oracledb://win-8bpntqktj5m:1521/XE/Dedicated”. It will be retransmitted after the retry interval specified for this Send Port. Details:”Microsoft.ServiceModel.Channels.Common.TargetSystemException: ORA-00936: missing expression —> Oracle.DataAccess.Client.OracleException: ORA-00936: missing expression

My first message looked like:

<Select xmlns=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<COLUMN_NAMES>*</COLUMN_NAMES>
<FILTER>where LAST_NAME=’King'</FILTER>
</Select>

As I assumed the syntax would be similar to WCF-SQL, but that was not the case. It should be:

<Select xmlns=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<COLUMN_NAMES>*</COLUMN_NAMES>
<FILTER>LAST_NAME=’King'</FILTER>
</Select>

Outcome of this message the following:

image

And in Oracle there are two employees with last name King.

image

Next thing I tried was an update using following statement:

<Update xmlns=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<RECORDSET>
<EMAIL>JAKING</EMAIL>
</RECORDSET>
<FILTER>EMPLOYEE_ID=156</FILTER>
</Update>

Which resulted in following response:

image

image

To insert new employee I used the following message:

<Insert xmlns=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<RECORDSET>
<EMPLOYEESRECORDINSERT>
<EMPLOYEE_ID>207</EMPLOYEE_ID>
<FIRST_NAME>Steef-Jan</FIRST_NAME>
<LAST_NAME>Wiggers</LAST_NAME>
<EMAIL>SWIGGERS</EMAIL>
<PHONE_NUMBER>0123456789</PHONE_NUMBER>
<HIRE_DATE>1999-05-31</HIRE_DATE>
<JOB_ID>IT_PROG</JOB_ID>
<SALARY>100000</SALARY>
<COMMISSION_PCT>0.35</COMMISSION_PCT>
<MANAGER_ID>100</MANAGER_ID>
<DEPARTMENT_ID>60</DEPARTMENT_ID>
</EMPLOYEESRECORDINSERT>
</RECORDSET>
</Insert>

And response message is similar to update.

image

image

Finally I deleted the previous inserted employee with delete statement:

<Delete xmlns=”http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES”>
<FILTER>EMPLOYEE_ID=207</FILTER>
</Delete>

The response was:

image

image

As result no data was found. As you can see it looks pretty straight forward, but takes some effort to setup things. You can find other Oracle sample for BizTalk 2010 Adapter pack here.

Technorati: biztalk server 2010

Fix for Error installing BAM Alerts on BizTalk 2010

If you receive an error while configuring the BAM Alerts under BAM Tools and the log has this error:

“Could not load file or assembly ‘Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91’ or one of its dependencies. The system cannot find the file specified.”

The BizTalk Install Guide has the install of the SQL 2005 Notification Services files located in Feature Pack for Microsoft SQL Server 2005 – December 2008, the XMO file from this location will not install, to get the SQL 2005 Notification Services to install the files located at Feature Pack for Microsoft SQL Server 2005 SP4 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7768393b-71fa-4281-83eb-cab08be4fb76) will work.

Hope this helps

Bill

What is Round Table?

Some time back I teased about something called Round Table, and the time has come to let the lid off of the idea.  Round Table is an idea that some of my friends and I are putting out there, a model which we believe in and are open to discussing with others.

Round Table’s Mission

Round Table seeks to improve the lives of our members through a focus on mentorship, accountability, and personal relationships.

We seek to live lives of constant learning through mentorship. It is our highest desire to see members grow together both by sharing knowledge, and openly discussing areas in need of growth.

We acknowledge that speaking openly about goals and challenges brings accountability. Our members should help each other to achieve dreams, and to develop the skills necessary to conquer challenges.

We hope to forge lasting personal relationships. As we support each other, we build trust and camaraderie that can last a lifetime.

Is Round Table A Group?

No, Round Table is a template for groups.  Unlike most User Groups, Round Table seeks to lay out a plan based on mentorship.  We expect some of you out there will either start your own group, or join one that someone else starts.

But, there isn’t anything about technology in that statement?!?

You are correct.  We believe these principles transcend technology, and encourage the formation of groups under the Round Table banner which are related to any field or interest.

Are there dues, or something?

No, all we ask for now is that if you are interested in founding a Round Table group that you send an email to RoundTable@TimRayburn.net and let us know about your group.  If the idea takes off, we will at least have a list of groups.

Are you going to found a group Tim?

Already have!

Round Table Craftsmen is our first such group, focused on those in the software development profession. We seek to grow our skills as technologists, and share those skills with others, while achieving our professional and personal goals. We will meet monthly to work on software and discuss our goals and challenges. If you would like to join us, we encourage you to speak to one of our members:

Blog Post by: The Admin

IE10 Preview – How Microsoft Competes in the Feature Olympics

Internet Explorer has made huge strides in the last couple of years.Microsoft has at last begun to lay the ghost of IE6 to rest with a solid, fast, standards compliant, reasonably up-to-date (not quite the same thing) forward-looking browser with the cleanest UI in the business.
However, one issue clouds the horizon.Other browsers, most notably Google Chrome, rev much faster that IE.The importance of this is that, by bringing out new versions on shorter (much shorter, in some cases) timescales, other browsers gain a clear advantage.They get emerging specifications and technologies out to end-users faster and therefore shape the future of the web in a way that IE could not touch for many years.This, in turn, builds a sense of momentum which increases the loyalty of the user base.Indeed, it is a major factor in growing the user-base, as we can see clearly with Chrome.With IE, by contrast, we have lived for years with a strong sense of Microsoft holding everyone else back.
Microsoft needs to speed up the cycle.I wondered if we would see any signs of this after the RTW of IE9 last month.Well, yes we can.Yesterday, Microsoft released Platform Preview 1 of IE10.Given Microsoft’s record, this is absolutely astounding and provides further evidence that the bad old days for IE really are receding.Of course, after three weeks of development, things are not that different to IE9, but the HTML5 story is improved, thanks chiefly to several new CSS3 features.
IE9’s HTML5 story is mixed.On the one hand, the browser lays a strong foundation for the future with comprehensive DirectX rendering and a much-repeated commitment to HTML5 as a future standard.On the other hand, the feature list count for HTML5 is noticeably lower than its nearest rivals.Put simply, IE9 supports less HTML5 than others, but supports it well.The IE team has repeatedly stated its position on this.Their main argument is that IE9 supports ‘site-ready’ HTML5 that will interoperate across all today’s browsers and avoids features on which there is still disagreement or which may not make it to the final specification.A secondary theme is that it was more important to develop the sub-systems that underpin a great HTML5 experience than strive after having the longest HTML5 feature list.
Broadly, the argument plays quite well.Given IE’s poor reputation amongst web developers, it is understandable that they want to stress their commitment to interoperability.Certainly, some of the other browsers are now carrying the burden of ‘HTML5’ features that won’t actually make it into the W3C Recommendation (whenever it finally arrives) and features which are not broadly interoperable with other browsers.Of course, it’s not really as clear cut as this.Some of the features that were once counted as part of HTML5 are still very much alive and kicking and will almost certainly be incorporated into future versions of HTML.
Try using each of the HTML5-enabled browsers in turn to browse the various HTML5 showcases provided by different vendors, and you will quickly get an idea of where HTML5 interoperability is really at, currently.And yes, the other HTML5 browsers tend to fare well on Microsoft’s HTML5 preview site in terms of functionality, suggesting that Microsoft’s take on HTML5 does indeed approximate to a ‘lowest common denominator’ interoperable approach.Of course, performance is a different story and seems to be the dominant theme of Microsoft’s showcase apps.
The myth that Microsoft spends its days subverting every standard going whilst all other players effortlessly deliver interoperable perfection has never been accurate since a brief period in the first half of the 1990’s when the company first ’won’ this reputation thanks to some fairly cynical actions (nothing, of course, to do with web standards).It is certainly the case that the complaint of poor standards compliance can no longer be honestly sustained with respect to IE9.However, IE9 illustrates a dilemma that all browser vendors face.It can take an eon for emerging web specifications to stabilise and for standards organisations to ratify and publish a given standard.It simply isn’t the role of organisations like the W3C to be in the vanguard of developing new specifications for everyone else to follow.There has been a huge misunderstanding about this for years.The W3C, and others, follow where the industry leads.They work to foster collaboration and agreement amongst those who are actually coming up with the ideas, trying out new innovations and pushing the boundaries.That means that the more innovative browsers will always be ahead of the curve and, consequently, in danger of subverting interoperability.
This, then, is the big question about IE’s HTML5 support.Now that Microsoft has convincingly closed the field on its rivals, will it be content simply to follow where others lead, trailing at the rear end of a densely-packed group of HTML.next ’feature-athletes’?Or should it attempt to move closer to the front of the pack in order to more effectively set the pace.Well, long-distance running is all about pacing and strategy.If you are in the race for the long-haul, it often pays to hold back for a while. I think it probably suits Microsoft’s purposes for the time being to merely match the pace set by others whilst all the time quietly building on their blindingly-fast DirectX rendering engine. And after all, we are still some way off seeing an equivalent Microsoft HTML5 technology for mobile devices which is where, increasingly, it really counts.I suspect they are attempting to maintain their stamina and build up their strength for a future push to the front.After all, Microsoft always preferred being in the industry driving seat.

Certified Trainer renewal – and why 400 is a magic cc limit

I renewed my Microsoft Certified Trainer “license” (if you so will) for another year today. I really do enjoy spending some time in the classroom now and then. I recognize that I might not always be the best pedagogue, though you should know I try, but I do hope that that mix of theoretic learning material with that crucial ingredient of real world experience gives “this is how this thing works” that extra nuance of “this is how this thing is actually used”. And that’s super important and often left outside of the course material since it’s hard to convey, but in many cases I believe I can bring that to the table.

To those that are unaware, the certified trainer is not really a certification that you pass, although you do need to have passed a certification as one of the requirements, it’s more of a affirmation of your ability and commitment to pass on your insight into your-technology-of-choice to others.

Or as the MCT site puts it:

Become part of an elite, international community that spans more than 150 countries and regions and includes classroom and e-learning instructors, learning consultants, authors, conference presenters, and user group leaders. Microsoft Certified Trainers (MCTs) are the premier technical and instructional experts on Microsoft technologies, and are the only individuals authorized to deliver training for Microsoft Certification.

Now, why is 400 (or really 4000 Swedish crowns) a magic limit to (my) credit card companies? Well, that’s roughly what the MCT renewal cost me, and it bounced. When I called the cc company to see why, and verify that it had, I got told that they had an outage of the system that day, and that only amounts below the 4k Swedish crown limit were automatically approved when the system was unavailable. That sounds like a security hole if any to me. I really do hope there are more safeguards in place around that. Or is there someone there in need of an MCT for some security best practices classes?

Blog Post by: Johan Hedberg