Oracle 10g and .NET: it just works

OK, this is sure to be really silly stuff for some of you, but as I do 9x% of my work with SQL Server, taming the Oracle beast is a real challenge for me. The very first round, filling a dataset:

using Oracle.DataAccess.Client;
...
 
    using (OracleConnection con = new OracleConnection("User Id=xyz;Password=zzzz;Data Source=orcl"))
    {
        try
        {
            OracleDataAdapter da = new OracleDataAdapter("select * from HR.EMPLOYEES", con);
            da.Fill(this.EmployeesDS.EMPLOYEES);
        }


        catch (OracleException ex)
        {
            EventLog.WriteEntry(ex.Message, EventLogEntryType.Error)
        }
    }

Here, ORCL is the Oracle instance (TNS) that I want to connect to and HR is the schema that I want to use. For this code to compile, we must make a reference to the Oracle.DataAccess assembly which lives (in the standar Oracle installation) in C:\oracle\product\10.1.0\Db_2\BIN. By the way, you need this folder in your PATH (yes, your PATH, that old Windows artifact) and read access to the folder (this is relevant to me, as I've been developing as a non-administrator since a few weeks ago, so far so good, I haven't become more productive but I feel better). This code also works as is if you use the Visual Studio 2003 Oracle Data Provider, all you have to do is change the using line and referencing the System.Data.OracleClient assembly. By the way, anybody out there has any suggestions as which data provider is better?

Published Wednesday, June 23, 2004 12:07 AM by Edgar Sánchez

Comments

# re: Oracle 10g and .NET: it just works

Wednesday, June 23, 2004 4:17 AM by Frans Bouma
10g's ODP.NET is indeed nice. We'll release Oracle 10g support with ODP.NET later today for LLBLGen Pro :)

There is one caveat with 10g's ODP.NET: ExecuteNonQuery doesn't return the amount of rows affected when the query is a batched query (for example an INSERT + a sequence CURRVAL select for reading back the used sequence val).

About which provider is better: we had long doubts which to pick: MS' provider or Oracle's. ODP.NET is a big download and has client restrictions, while the MS provider apparently seems to work fine with 10g and every client that can connect to 8i or higher. We went for Oracle's because of its solid REF CURSOR support: you can simply bind these to a dataset and the adapter fills the dataset nicely. I know for a fact that a lot of procs on Oracle use REF CURSOR to return sets so this is really a plus.

Also a plus is the bugfixes Oracle does to its provider while MS doesn't fix bugs in the Oracle provider because that would require a bugfix to .NET and these apparently aren't released.

I do wonder though if .NET 1.1's provider will work with 10g easily. After all, what I said about the ExecuteNonQuery return value can break a lot of code in .NET because suddenly no rows are affected, which will lead to concurrency exceptions in the data-adapter.

I also doubt you can simply change a using line and that's it. ODP.NET has some aspects like the type of returned values, which can make code become non-portable between the two providers.

# re: Oracle 10g and .NET: it just works

Wednesday, June 23, 2004 7:30 AM by Edgar Sanchez
Wow, I mean, this is great feedback. The REF CURSOR part and the bugfixes comment are useful. About changing just one line to switch providers, all I said is that it works in my very simple example, I had no hopes about it in real life situations (hence the urge to know which data provider is better). By the way, do you have anything to comment about performance?

# Oracle 10g and .NET: it just works

Friday, June 25, 2004 3:31 AM by TrackBack

# Oracle » Blog Archives » … Oracle 10G Application Server (7 Sep 2004

PingBack from http://chaespot.com/oracle/2006/08/23/oracle-10g-application-server-7-sep-2004/

# Oracle » Blog Archives » … Oracle Database List of Bugs Fixed, 10g

PingBack from http://chaespot.com/oracle/2006/08/26/oracle-database-list-of-bugs-fixed-10g/

# Oracle » Blog Archives » Oracle News for the professional … Monitoring. Remote

PingBack from http://chaespot.com/oracle/2006/10/02/oracle-news-for-the-professional-monitoring-remote/

# re: Oracle 10g and .NET: it just works

Thursday, January 24, 2013 8:48 PM by Nida Lidge

Your style is really unique compared to other folks I have read stuff from. Thanks for posting when you've got the opportunity, Guess I will just book mark this web site.

# re: Oracle 10g and .NET: it just works

Friday, January 25, 2013 5:13 PM by Tessa Povey

Hello, I do think your site may be having web browser compatibility problems. Whenever I look at your site in Safari, it looks fine however, when opening in I.E., it's got some overlapping issues. I simply wanted to give you a quick heads up! Aside from that, fantastic website!

# re: Oracle 10g and .NET: it just works

Monday, January 28, 2013 1:29 PM by Melda Marlett

I could not resist commenting. Exceptionally well written!

# re: Oracle 10g and .NET: it just works

Monday, January 28, 2013 9:59 PM by Maranda Wenzel

Having read this I thought it was really informative. I appreciate you taking the time and energy to put this content together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worthwhile!

# re: Oracle 10g and .NET: it just works

Tuesday, January 29, 2013 5:56 AM by Zenobia Moutoux

The very next time I read a blog, Hopefully it won't disappoint me as much as this particular one. After all, Yes, it was my choice to read through, nonetheless I actually believed you would have something interesting to say. All I hear is a bunch of moaning about something you can fix if you were not too busy searching for attention.

# re: Oracle 10g and .NET: it just works

Tuesday, January 29, 2013 2:43 PM by Viola Duenes

This is a topic which is close to my heart... Many thanks! Where are your contact details though?

# re: Oracle 10g and .NET: it just works

Tuesday, January 29, 2013 9:52 PM by Chu Spano

After I originally commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now every time a comment is added I get four emails with the exact same comment. Is there an easy method you can remove me from that service? Appreciate it!

# re: Oracle 10g and .NET: it just works

Wednesday, January 30, 2013 5:49 AM by Kasie Hoa

I blog quite often and I really appreciate your content. This article has really peaked my interest. I'm going to bookmark your site and keep checking for new information about once a week. I subscribed to your Feed as well.

# re: Oracle 10g and .NET: it just works

Thursday, January 31, 2013 7:10 PM by Arline Zaccaro

Excellent web site you have got here.. It’s difficult to find high quality writing like yours these days. I seriously appreciate people like you! Take care!!

# re: Oracle 10g and .NET: it just works

Friday, February 01, 2013 8:16 AM by Bailey Filipelli

Excellent blog post. I definitely love this website. Keep it up!

# re: Oracle 10g and .NET: it just works

Friday, February 01, 2013 3:01 PM by Elaina Catena

Good article. I am experiencing a few of these issues as well..

# re: Oracle 10g and .NET: it just works

Saturday, February 02, 2013 3:39 AM by Kenisha Bakke

Hi there! I could have sworn I’ve visited this website before but after going through some of the articles I realized it’s new to me. Anyhow, I’m certainly happy I discovered it and I’ll be book-marking it and checking back regularly!

# re: Oracle 10g and .NET: it just works

Monday, February 04, 2013 4:56 AM by Sandee Badman

I’m impressed, I must say. Seldom do I come across a blog that’s both equally educative and amusing, and let me tell you, you have hit the nail on the head. The issue is something not enough folks are speaking intelligently about. I am very happy I came across this in my search for something regarding this.

# re: Oracle 10g and .NET: it just works

Tuesday, February 05, 2013 4:51 AM by Charis Eland

Way cool! Some extremely valid points! I appreciate you penning this write-up plus the rest of the site is also very good.

# re: Oracle 10g and .NET: it just works

Tuesday, February 05, 2013 1:45 PM by Claribel Alday

Hello there, There's no doubt that your web site could possibly be having web browser compatibility problems. Whenever I look at your web site in Safari, it looks fine but when opening in Internet Explorer, it's got some overlapping issues. I merely wanted to provide you with a quick heads up! Aside from that, wonderful blog!

# re: Oracle 10g and .NET: it just works

Tuesday, February 12, 2013 11:07 AM by Conception Kuwahara

I really like it when folks come together and share ideas. Great website, stick with it!

# re: Oracle 10g and .NET: it just works

Saturday, February 16, 2013 7:40 PM by Valencia Brozowski

Hello there! This article could not be written any better! Going through this article reminds me of my previous roommate! He constantly kept preaching about this. I am going to send this information to him. Pretty sure he'll have a very good read. Many thanks for sharing!

# re: Oracle 10g and .NET: it just works

Monday, February 18, 2013 6:14 AM by Chanel Colbert

Good post. I am facing many of these issues as well..

# re: Oracle 10g and .NET: it just works

Thursday, February 21, 2013 10:31 AM by September Newmark

After looking over a number of the blog articles on your blog, I truly like your way of blogging. I saved as a favorite it to my bookmark site list and will be checking back in the near future. Please check out my website too and let me know how you feel.

# re: Oracle 10g and .NET: it just works

Thursday, February 21, 2013 9:10 PM by Nathalie Vanderjagt

I blog quite often and I really appreciate your content. Your article has truly peaked my interest. I'm going to take a note of your site and keep checking for new information about once a week. I subscribed to your RSS feed as well.

# re: Oracle 10g and .NET: it just works

Friday, February 22, 2013 7:21 AM by Sharilyn Cocoran

Saved as a favorite, I love your site!

# re: Oracle 10g and .NET: it just works

Saturday, February 23, 2013 3:26 AM by Kathryn Ereth

You need to be a part of a contest for one of the greatest sites online. I most certainly will recommend this site!

Leave a Comment

(required) 
(required) 
(optional)
(required)