c# - How to connect to a remote Oracle database -
i have connect remote oracle dbms .net c# web service
- is request client oracle installation? why?
- when have use odp.net
thanks
i recommend using odp.net, it's free , "official" ado.net compatible provider connecting oracle.1
to spare users having separately install oracle client, download oracle instant client, take following files there...
oci.dll oracle.dataaccess.dll (the managed odp.net assembly itself) orannzsbb11.dll oraociei11.dll oraops11w.dll
...and distribute them application.
unfortunately, of these dlls native (and 32-bit / 64-bit specific), won't able build "any cpu" platform (yet2).
the .net code identical use under "fat" oracle client (and similar other ado.net provider out there), except should consider using "tnsnames.ora independent" connection string such as:
data source=(description=(address_list=(address=(protocol=tcp)(host=myhost)(port=myport)))(connect_data=(server=dedicated)(service_name=myoraclesid)));user id=myusername;password=mypassword;
1 there commercial alternatives , old microsoft's provider deprecated (and won't save having install oracle native dlls anyway).
2 either wait fully managed oracle provider, or edit project file (the msbuild xml) conditionally include 32-bit or 64-bit dlls depending on build platform, similar this:
<choose> <when condition="'$(platform)' == 'x64'"> <itemgroup> <reference include="oracle.dataaccess, processorarchitecture=x64"> <specificversion>false</specificversion> <hintpath>..\thirdparty\odp.net\x64\oracle.dataaccess.dll</hintpath> </reference> <content include="..\thirdparty\odp.net\x64\oci.dll"> <link>oci.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x64\orannzsbb11.dll"> <link>orannzsbb11.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x64\oraociei11.dll"> <link>oraociei11.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x64\oraops11w.dll"> <link>oraops11w.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> </itemgroup> </when> <when condition="'$(platform)' == 'x86'"> <itemgroup> <reference include="oracle.dataaccess, processorarchitecture=x86"> <specificversion>false</specificversion> <hintpath>..\thirdparty\odp.net\x86\oracle.dataaccess.dll</hintpath> </reference> <content include="..\thirdparty\odp.net\x86\oci.dll"> <link>oci.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x86\orannzsbb11.dll"> <link>orannzsbb11.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x86\oraociei11.dll"> <link>oraociei11.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> <content include="..\thirdparty\odp.net\x86\oraops11w.dll"> <link>oraops11w.dll</link> <copytooutputdirectory>preservenewest</copytooutputdirectory> </content> </itemgroup> </when> </choose>
Comments
Post a Comment