views:

804

answers:

3

I have to develop a tool in C# that retrieves some data from an Oracle DB. Since our IT support is having some trouble with installing the Oracle client, I want to be able to connect to the database without the client installed. The idea is to just install (and maybe register) an additional library together with the app.

Which alternatives to the Oracle client exist, and what are their pros and cons?

This is for a small application (1 form, 2 or 3 queries, the result displayed in a DataGrid, probably no more than 10-20 data sets), but I am also interested in scalability issues, since we may also move away from the Oracle client with bigger future projects.

Of course a freeware solution would be nice, but we are not limited to that.

A: 

The enterprise library client System.Data.OracleClient is a viable alternative to the ODP.NET provider from Oracle. There are severla caveats you should know though, using the Microsoft client will make it extremely difficult to work with any type of large objects whether they are XML strings, CLOBs, LOBs or BLOBs. Also the Oracle XmlType column is not supported and must be casted to a CLOB to be returned into the OracleClient.

Chris Marisic
If you do need to work with LOBs I wrote a blog post on the subject: http://dotnetchris.wordpress.com/2008/04/10/writting-lobs-clobs-to-oracle-using-c-aspnet-20/ IMO it is the best viable solution, just make sure that you have connection pooling working to use it.
Chris Marisic
Taken from MSDN for System.Data.OracleClient: "You must also have Oracle 8i Client or later installed." Exactly what I want to avoid, I'm afraid...
Treb
OracleClient is also deprecated by MS now.
gbjbaanb
+5  A: 

There are a couple different flavors of the Oracle ODP.Net driver. Which version are you trying to use?

It sounds like you want the Oracle 11g ODAC 11.1.0.6.21 with Xcopy Deployment, which allows you to deploy the Oracle Instant Client and the ODP.Net driver just by copying a few DLLs over and registering them. That doesn't require a full-blown Oracle client installation.

Justin Cave
Exactly. Our company network is chaotic, with no tracking of what is installed where. I want to make certain that the app will run on all computers it is installed on, without needing to determine the Oracle client installed and requesting IT to upgrade it and wait for them to get around to do it...
Treb
+5  A: 

Your task can be achieved without the need of any third party software:

  1. Install Oracle Data Access Components 11g in your development box. ODAC 11g is backwards compatible with 9i and 10g
  2. Add a reference to the ODAC library in your .NET projects (Oracle.DataAccess.dll).
  3. Allow your application to connect without the use of TNSNAMES.ORA. To do so, you have to include the connect descriptor in the connection string:

    "user id=scott;password=tiger;data source=" + "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)" + "(HOST=sales-server)(PORT=1521))(CONNECT_DATA="+ "(SERVICE_NAME=sales.us.acme.com)))"

Since you are including the connect descriptor in the connection string, the thin client is not required in the targeted computers.

Happy deployment.

Igor Zelaya
Thanks, will have a look at it ASAP!
Treb