Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

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

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 I want to deploy the application and install it in another "clean machine" that has the .NET Framework only! And I don't want to install the whole ODAC component to the user!

How could I do that? I have tried to include all the necessary DLL files to my bin folder, like:

  • oci.dll
  • ociw32.dll
  • Oracle.DataAccess.dll
  • orannzsbb11.dll
  • oraocci11.dll
  • oraociicus11.dll
  • OraOps11w.dll
  • msvcr71.dll

But still it didn't work. What should I do to solve this problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...