Oracle Instant Client with C # Forms Application

I searched for this for a long time, I developed a Windows Forms application using C # that needs to connect to an Oracle database, this application will be used on many PCs using Windows XP and Windows 7. After much research, I found that I need to use OBP. net to access the oracle, but the problem is that I cannot install the oracle client on every PC. However, I found work in CodePorject Example to load 5 DLL files to do the same job

OCI Instant Client Data Shared Library oraociicus10.dll (Basic-Lite version) oraociei10.dll (Basic version) Client Code Library oci.dll Security Library orannzsbb10.dll OCCI Library oraocci10.dll 

But when I launch the application, it will connect to the Oracle Database. Please help, how can I connect the Windows Forms application to the Oracle database without the oracle client installed on the computer, and if this is possible through the aforementioned DLLS, how can I do this?

EDIT:

 DataTable dt = new DataTable(); OracleConnection Oracle_connection = new OracleConnection(); Oracle_connection.ConnectionString = con; Oracle_connection.Open(); 

Received connection timeout, in Oracle_connection.Open(); in debug mode, and I am not using TNSNAMES.ORA since my connection string is

 Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.20.2.54)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = PRD))) ;User Id=catering;Password=catering;"` 

Tried to publish code that it worked on a Windows 7 PC, but didn’t work on a Windows XP System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client at Oracle.DataAccess.Client.OracleInit.Initialize() System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> Oracle.DataAccess.Client.OracleException The provider is not compatible with the version of Oracle client at Oracle.DataAccess.Client.OracleInit.Initialize()

I don't know if this is related to windows or some DLLs

+4
source share
3 answers

There is also a fully managed .net aka connector. ODP.NET managed driver:

I tested it on Windows 8 and Windows XP Service Pack 3 (SP3) with the .NET 4.0 platform installed - everything works as expected. Deployment requires only 1 dll (Oracle.ManagedDataAccess.dll), which weighs 6 MB (compared to the instant client, which was almost 40 MB).

UPDATE: Probably the best way to use the oracle managed driver is through NuGet ( ODP.NET @nuget )

+2
source

ODP.net is fussy about mixing version numbers. Error message:

System.TypeInitializationException: The type initializer for "Oracle.DataAccess.Client.OracleConnection" made an exception. ---> Oracle.DataAccess.Client.OracleException The provider is incompatible with the Oracle client version in Oracle.DataAccess.Client.OracleInit.Initialize ()

indicates that it is somewhere collecting the wrong version of the DLL client. When I did some development with Oracle and Visual C # 2010, I downloaded the ODP.NET libraries from:

http://www.oracle.com/technetwork/developer-tools/visual-studio/downloads/index.html

Then I took the correct version for the version of Oracle that I will work on and use these DLLs in my project. However, I'm not sure what restrictions apply to redistribution.

0
source

Check out this topic: The provider is not compatible with the version of the Oracle client.

The DLLs listed there completed the task for me (all in the same directory as exe).

0
source

All Articles