JS

Sunday, October 11, 2015

Connecting to an oracle database without installing an Oracle Client

To setup your website to use a tnsnames.ora file without having to install an Oracle Client:

Method 1:
  1. Put your tnsnames.ora file in the folder "C:\Windows\System32\inetsrv" (Or "C:\Windows\SysWOW64\inetsrv" if you have a 64-bit OS)
  2. do an IIS Restart (iisreset) or just recycle the application pool for the application.

Method 2:
  1. Create a folder where you would like to put your tnsnames.ora (for example c:\tnsnames)
  2. Add an environment variable (if you don't know how to add an environment variable, please search google) named TNS_ADMIN with the value of the path of the tnsnames folder (for our example "c:\tnsnames")
  3. Restart your machine to allow windows to see the new variable.
  4. Note: you may need to add Read Permissions on the tnsnames folder for the IIS application pool user to allow it to read the tnsnames.ora file
  5. Note 2: Anytime you change anything in the content or permissions or the tnsnames,ora file, you will need to do an IIS Restart (iisreset) to make sure that the IIS server reads the new file.

To use the Oracle Client in your website:
  1. First you will need to get the Oracle.ManagedDataAccess.dll file from an Oracle Client Installation, it's located in the "(OracleHome)\odp.net\managed\common" folder.
  2. Copy the file to your website's "bin" folder.
  3. In your website include the Oracle.ManagedDataAccess.Client namespace




No comments:

Post a Comment

No Spam Please