Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Friday, October 19, 2007

Cannot Delete OCI.DLL in Oracle Client BIN

In the process of re-installing a different version of the Oracle client, I needed to un-install the first version. I went through the de-install process with the Universal Installer:



Then I attempted to delete the client_1 folder at C:\oracle\product\10.2.0\client_1\BIN but received an error and was unable to delete. I tried deleting all of the files in the \bin directory and was left with oci.dll

There were no Oracle services running.

I renamed "oci.dll" to "delete.txt" and rebooted the server. I was then able to delete the folder and start fresh.

Thursday, October 18, 2007

Could not load file or assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies.

I am moving an ASP.NET 2.0 application to another environment. On the new server I get the following error on my Web page:

Could not load file or assembly 'Oracle.DataAccess, Version=2.102.2.20, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I notice the client is 10.1 on the server so I install 10.2:
Oracle Database 10g Client Release 2 (10.2.0.1.0)
Selected 'Administration' in the installation to get all of the BIN files.

NOTE: ORACLE_HOME Environment Variable is no longer used.



I install ODAC on the server:
Oracle10g Release 2 ODAC 10.2.0.2.21

I did not realize that a different 10.2 client was installed on my local:

Local
Oracle Data Provider for .NET 10.2.0.2.20 Production
The Oracle.DataAccess.dll is pathed to: D:\oracle\product\10.2.0\client_1\odp.net\bin\2.x
Web.config:


Server
Oracle Data Provider for .NET 10.2.0.1.0
The Oracle.DataAccess.dll is pathed to: D:\oracle\product\10.2.0\client_1\BIN

So, I'm thinking that if I just modify the Web.config, it will work:


I get this error: "The provider is not compatible with the version of Oracle client"

I copy the Oracle.DataAccess.dll from local to the BIN directory of the ASP.NET application, and then over to the server. Modifying the Web.config does not resolve the issue.

Solution


After spending more time wrestling with a connection, I find out that our DBA's have a copy of the older ODAC (which I can't find on the Oracle site).

Now I get another error:
"Unable to load DLL 'OraOps10w.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)"

I added the ASPNET account to the BIN folder security settings and propigated the permissions, but still received the error. The magic bullet was - RE-BOOT! It works!

In searching the forums I found someone of "like mind":
"We should not have to install anything on the server, especially not 400+ MB of oracle client tools just to connect to and query a database."

Wednesday, October 17, 2007

Working with Oracle and ASP.NET 2.0

The Oracle Client with Enterprise Manager for remote administration
http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html has the Oracle 10g Client. Choose ‘Administrator’ during installation to include the client and Enterprise Manager.

Oracle Express Database for local development / testing
Local installation should be the Oracle Express version for free at: http://www.oracle.com/technology/software/products/database/xe/index.html

Oracle SQL Developer for database design
http://www.oracle.com/technology/products/database/sql_developer/index.html

Friday, October 12, 2007

Oracle SQL and C# Dates

If you are working with Oracle and C#, you may need to insert a Date into the database. The way this is done, is to specifiy a date format and then let Oracle know what the format is by using the "to_date" function. One of the problems is that C# and Oracle specifiy date formats differently.

Here is one example:
strFromDate = myFromDate.ToString("MM/dd/yyyy hh:mm:ss tt");
strToDate = myToDate.ToString("MM/dd/yyyy hh:mm:ss tt");

_sqlQuery += "AND DATE_COMPLETED >= to_date('" + strFromDate + "', 'MM/DD/YYYY HH:MI:SS PM') ";
_sqlQuery += "AND DATE_COMPLETED <= to_date('" + strToDate + "', 'MM/DD/YYYY HH:MI:SS PM') ";

Check This Out!

More Links to Good Information