Deploying the minimum Oracle Instant Client files with ODP.NET

If you’re looking for the smallest and least hassle deployment of Oracle client files with a .NET application, then forget about everything else you’ve been told – the following did the trick for me, and involves just 5 Oracle dll’s.

Deploying ODP.NET with Oracle Instant client

One thing I found with this was that on my dev machine I already have (more than) one ‘standard’ Oracle installation and all the network config from that was really getting in the way meaning I couldn’t connect for one reason or another – OR I was connecting, but not using the correct client, meaning deployed files wouldn’t work on a ‘virgin’ machine.  All of this rather depends on how your company deploys Oracle server and clients I guess.

Rather than muck about with setting environment variables (that’s so 80’s) if you use a full connection string syntax as follows you can use your hostname and SID rather than try and fathom out service names. 

In your web.config

  <add name=”MyDB” connectionString=”Data Source=(DESCRIPTION = (ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = machinename)(PORT = 1521)))(CONNECT_DATA =(SID = mysid)));User Id=username;Password=password;” providerName=”” />

Any other variation of the (mucho confusing) Oracle connection syntax just didn’t work for me.

As an aside – I also kept getting System.OutOfMemoryException when building a web site project in Visual Studio 2008 when I was using the Oracle Basic client dll’s (110mb +).  I switched to the smaller Basic ‘Lite’ versions and it was happy again.  I guess a single file of over 100mb blows the lid off the IDE.