Scenario you support an application that connects to MS SQL, Oracle, DB2, and so on and so forth. You may or may not use an ORM and or you just want to connect directly to the database. You do not want to use up the resources by installing the full Oracle client.
What do you need to accomplish this?
A .NET project
Download the ODAC xcopy version (as of this article the latest was 18.104.22.168.1)
Copy the following dll’s from the ODAC folder to either the bin (if web) or location of the exe file
- oci.dll (Client Code Library)
- orannzsbb11.dll (Security Library)
- oraocci11.dll (OCCI Library)
- oraociei11.dll (OCI Instant Client Data shared Library)
You can create your tsanames.ora from either code or in web.config
string Connstring = "Data Source=(DESCRIPTION=" + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)" + "(HOST=serverName)" + "(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)" + "(SERVICE_NAME=DatabaseName)));" + "User Id=UserName;Password=UserPassword;";
Then just create your open connection like normal
Here is an example solution.