Development With A Dot

Blog on development in general, and specifically on .NET

Sponsors

News

My Friends

My Links

Permanent Posts

Portuguese Communities

April 2009 - Posts

WSS 3.0 and MOSS 2007 SP2 Released

Read about it and download it from http://blogs.msdn.com/sharepoint/archive/2009/04/28/announcing-service-pack-2-for-office-sharepoint-server-2007-and-windows-sharepoint-services-3-0.aspx.

Don't forget also the language packs for WSS and MOSS.

Programming Entity Framework Book

Programming Entity Framework

I just got Julia ("Julie") Lerman's Programming Entity Framework book. You will find her site here.

I like the book, and I like EF, but I wasn't aware of the many limitations that the current version of Entity Framework has, particularly when comparing to LINQ to SQL. I will post some of my findings here, in future blogs.

Using TransactionScope with ODP.NET

If you are using Oracle Database Provider for .NET (ODP.NET) and you want to use TransactionScope'd transactions, you may have gotten the dreaded "Data provider internal error(-3000) [System.String]" exception. I'll explain how I fixed it.

First, if you want to support distributed transactions, make sure you have the OracleMTSRecoveryService service installed and running on your machine (it comes with the Oracle Data Access Components installation), or any other machine on your network, as long as properly configured on the MSDTC tab on the Component Services applet.

If you don't need distributed transactions, you can place the connection string setting PROMOTABLE TRANSACTION=LOCAL on your connection string, for example:

DATA SOURCE=(DESCRIPTION=(ADDRESS=(COMMUNITY=TCP.Some.Community)(PROTOCOL=TCP)(HOST=Some.Host)(PORT=1522))(CONNECT_DATA=(SID=SomeSid)));USER ID=SomeUsername;PASSWORD=SomePassword;PROMOTABLE TRANSACTION=LOCAL

Now you can have:

using (TransactionScope tx = new TransactionScope())

{

    using (OracleConnection con = new OracleConnection(@"DATA SOURCE=(DESCRIPTION=(ADDRESS=(COMMUNITY=TCP.Some.Community)(PROTOCOL=TCP)(HOST=Some.Host)(PORT=1522))(CONNECT_DATA=(SID=SomeSid)));USER ID=SomeUsername;PASSWORD=SomePassword;PROMOTABLE TRANSACTION=LOCAL"))

    using (OracleCommand cmd = con.CreateCommand())

    {

        con.Open();  //no longer crashes here

        cmd.CommandText =
"SELECT sysdate FROM dual";        DateTime date = (DateTime)cmd.ExecuteScalar();

    }

}

If you need more information, check the Oracle Data Provider for .NET Developer's Guide, it's the e10927.pdf file on the B28359_01\win.111 folder of the Oracle documentation (version 11g).

More Posts