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 188.8.131.52.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.
Thanks Chad, this saved us a bit of research (and by research, I mean trial and error) 🙂
Damn, do you still have your source file?
Try again Abrham, sorry about that, i had some issues with Skydrive a few days ago.
Hi, can you upload the oarcletest.zip again?
Maybe you can set TNSADMIN environment variable to a tnsadmin.ora file, put an entry in that file and references that on connection string of web.config file.
It is very usefull
OracleTest.zip don’t exists! 😦