Related Entries

Is ADO.Net portable?
Slashdot: Java vs .Net
Variable number of function arguments in C#
C# day 3
Mozilla intentionally breaks ASP.Net pages?

« Slashdot: Java vs .Net
» Web services notes

Oracle with C#

What has 3 seconds got to do with opening an Oracle connection from Microsoft's .Net provider for Oracle?

Since I work a lot with Oracle databases, the way I usually evaluate technologies is by checking how well behaved (execution/development/deployment speed) the technology is with Oracle. Java, Python, PHP and Perl are all very good in working with Oracle. ASP with VBScript was a miserable experience, especially when combined with stored procedures.

Recently, I tried Microsoft’s Oracle.NET provider. Wrote a program to print results of a simple SQL; way too slow.

Here’s the code.

The query is straight-forward SQL. After some analysis, found that it takes around 3 seconds to establish the connection. My initial suspicion was that my firewall was blocking it till I said it is OK to proceed. Unfortunately, that is not the case - the delay is still there after I disabled the firewall.

It *always* takes 3 seconds! May be I’m too suspicious, but it looks to me like some one is playing dirty :-) May be Microsoft put in a delay loop to get people to use SQL Server; or Oracle put in a delay loop to get people to use their provider, ODP.Net. There were some rumours about MS adding a delay loop in their ODBC driver for Oracle, when that was released way before Oracle’s own ODBC driver - history can repeat itself, right?

Similar Java code from the same client machine to the same server at same times have no delays. As soon as the JVM starts, I get the results.

I haven’t tried ODP.Net yet; hoping to try it this week and see how it performs.

  1. Interesting indeed. If this is truly the case, then I would recommend trying ODP.NET. I use it for some internal ASP/C# applications and it is blazing fast. Although I still prefer JDBC etc., I find that if I must use C#, Oracle9i and ODP.NET cannot be beat!

    Posted by: Justin on October 26, 2003 10:30 PM
  2. This code of urs is fine, if i have a TNS entry in Tnsnames.ora file. I want to connect to a remote oracle database, using the following connection properties:
    1. SID
    2. Network Address
    3. Port
    4. User Id
    5. Password.

    It will be really great if you can give me a solution.

    Thanks,
    Raj!

    Posted by: Rajasekhar on April 26, 2004 06:03 PM
//-->