.NET安装和配置Oracle数据访问组件(ODAC)

Many ASP.NET applications access Oracle database for the data source. Oracle supports the .NET with its Oracle Data Access Components (ODAC). By using ODAC, you do not have to install a heavy Oracle client in the Windows server machines which have IIS for the ASP.NET applications.

ODAC includes Oracle Instant Client, Oracle Providers for ASP.NET, and Oracle Data Provider for .NET. Oracle Instant Client is necessary since it has Oracle’s database APIs - OCI libraries for an Oracle database client in Windows systems to connect Oracle database server. Oracle Providers for ASP.NET, and Oracle Data Provider for .NET. are required to install if you are using Oracle providers in your ASP.NET or .NET applications.

If you using the .NET Framework Data Provider for Oracle which is in the System.Data.OracleClient namespace (The assembly System.Data.OracleClient.dll included in the .NET frameworks), you do not need to install Oracle Providers for ASP.NET, or Oracle Data Provider for .NET. For more information about System.Data.OracleClient namespace, see Oracle and ADO.NET on MSDN.

Let’s start the installation and configuration.

1. Download the latest version ODAC112030Xcopy_32bit.zip orODAC112030Xcopy_x64.zip zip file from Oracle web site and unzip the .zip file in a local folder in Windows.
For 32-bit: C:\temp\ODAC112030Xcopy_32bit
For 64-bit: C:\temp\ODAC112030Xcopy_x64

2. You can install either 32-bit ODAC or 64-bit ODAC, or both. Open a Command Prompt with the Administrator privilege, go to the folder above, type and run the installation script:
For 32-bit:
C:\temp\ODAC112030Xcopy_32bit>install.bat basic c:\oracle\odac32 odac32 false
For 64-bit:
C:\temp\ODAC112030Xcopy_x64>install.bat basic c:\oracle\odac odac false
This will install the Oracle Instant Client into the folder c:\oracle\odac32 orc:\oracle\odac. Notice “Oracle Home Name” in the installation script parameters:odac32(for 32bit) or odac(for x64). Oracle Home Name has to be different if you want to install both 32-bit and 64-bit ODAC.

3. This step is to install Oracle providers. If you only use the .NET Framework Data Provider for Oracle, you can skip this step.
To install ODP, in the same Command Prompt, type and run installation script:
For 32-bit Oracle Data Provider for .NET 4:
C:\temp\ODAC112030Xcopy_32bit>install.bat odp.net4 c:\oracle\odac32 odac32 false
For 64-bit Oracle Data Provider for .NET 4:
C:\temp\ODAC112030Xcopy_x64>>install.bat odp.net4 c:\oracle\odac odac false

To install ASP.NET Provider, in the same Command Prompt, type and run installation script:
For 32-bit Oracle Provider for ASP.NET 4:
C:\temp\ODAC112030Xcopy_32bit>>install.bat asp.net4 c:\oracle\odac32 odac32 false
For 64-bit Oracle Provider for ASP.NET 4:
C:\temp\ODAC112030Xcopy_x64>>install.bat asp.net4 c:\oracle\odac odac false

4. Setup PATH System Environment Variable for IIS Windows web server. Since ODAC communicates Oracle database through OCI in the Oracle Instant Client, and OCI libraries are the native Windows librarys, you have to tell IIS where to load those libraries. Add the path of c:\oracle\odac32 or c:\oracle\odac into the PATH System Environment Variable.
After set PATH System Environment Variable, reboot machine to make the System Environment Variable effective.

 

转载自:http://www.simongong.com/blogs/?p=11

posted on 2013-06-24 09:52  Maxwell Hu  阅读(1367)  评论(0编辑  收藏  举报