Click here to Skip to main content
15,887,821 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I have developed a client server application targeting 3.5 framework and followed this link Instant Oracle Using C#[^] to connect to the oracle database on server.

But i'm getting "Provider is not compatible with the version of oracle client" exception. I'm working on windows 7 32 bit pc which does not have any oracle client installed. As said in the link i have placed the dlls including oraops.dll(not mentioned in the article) in the directory where exe files exist.My connection string is:
conn.ConnectionString = "User ID=macw_conv;Password=blaster2;Data Source=(DESCRIPTION=" +
"(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=moeprodv4.dafs.state.me.us)(PORT = 1530))"+
"(CONNECT_DATA=(SID=macwprod)(SERVER = DEDICATED)));";
I wasn't sure if this would work so i added tnsnames.ora as well. Server has oracle 10g database and the dlls are from the current release 11.2. Do I have to make changes to config file? I'm unable to figure out what the problem is ?


The type initializer for 'Oracle.DataAccess.OracleConnection'threw an exception.
Stack trace is:

HTML
<pre lang="text">System.TypeInitializationException was unhandled
  Message=The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
  Source=Oracle.DataAccess
  TypeName=Oracle.DataAccess.Client.OracleConnection
  StackTrace:
       at Oracle.DataAccess.Client.OracleConnection..ctor()
       at WindowsFormsApplication1.frmVoiceFileMover2.cmdGetId_Click(Object sender, EventArgs e) in C:\Users\deepthi.motkur\Desktop\VoiceFileMover2\VoiceFileMover2\Voice File Mover.cs:line 271
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WindowsFormsApplication1.Program.Main() in C:\Users\deepthi.motkur\Desktop\VoiceFileMover2\VoiceFileMover2\Program.cs:line 15
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: Oracle.DataAccess.Client.OracleException
       Message=The provider is not compatible with the version of Oracle client
       Source=Oracle Data Provider for .NET
       ErrorCode=-2147467259
       DataSource=""
       Number=-1011
       Procedure=""
       StackTrace:
            at Oracle.DataAccess.Client.OracleInit.Initialize()
            at Oracle.DataAccess.Client.OracleConnection..cctor()
       InnerException:


Any help is apprciated..

Thanks
Posted
Updated 25-Oct-12 11:34am
v2
Comments
John d. Bartels 25-Oct-12 20:51pm    
See the following links:

http://www.thebestcsharpprogrammerintheworld.com/blogs/connect-to-an-oracle-database-without-an-oracle-client.aspx

http://stackoverflow.com/questions/3935808/how-can-i-deploy-a-net-application-that-uses-odac-without-installing-the-whole

I can not take credit for either of them, but I have used the code from the first link, and it works great (although I've heard its not a best practice, and that the Oracle Client should be installed on the target workstation... Also the first link instructs you to install .NET 4.0, so I'm not sure if that is what you want or not, but this may help)
Member 9542426 26-Oct-12 14:08pm    
Thanks for the reply. I do have framework 4 installed in my test machine. i think i should try packaging instant client along with the application instead of just the dlls.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900