How can I deploy a .NET application that uses ODAC without installing the whole component to the user?

前端 未结 3 1125
暖寄归人
暖寄归人 2020-11-29 19:44

I have written a C# application that connects to an Oracle 10g database. Using Oracle Data Access Component 11.2 \"ODAC\", it works perfectly on my machine.

And now

3条回答
  •  鱼传尺愫
    2020-11-29 19:54

    You don't need to install any Oracle client separately. I installed the following in the same directory as the .exe:

       Oracle.DataAccess.dll
    
       oci.dll 
    
       OraOps11w.dll
    
       oraociei11.dll
    
       msvcr71.dll 
    

    Make sure your project references the same Oracle.DataAccess.dll that you are delivering. This worked on a fresh pc which had never had oracle clients installed.

    I avoided using TNSNAMES.ora by specifiying a connection string like this

    connectionstring = Data Source="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))" + "(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME = )))"

    If you are using TNSNAMES.ora just cut and paste the connection details into a single line string.

    see What is the minimum client footprint required to connect C# to an Oracle database?

    for more information.

    • ejm

    For information on how to obtain the above dlls, see this tutorial: http://begeeben.wordpress.com/2012/08/01/accessing-oracle-database-without-installing-oracle-client/

提交回复
热议问题