Oracle DB connection not working

partha.majumdar

Active member
Joined
Aug 13, 2006
Messages
33
Location
Kolkata
Programming Experience
10+
Dear Sir/Madam,

I had a test code to connect to oracle database which was running fine. However, now I am getting the below exception.

Please help.

Regards,
Partha

==============================
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(St ring connectionString)
at TestApp.Form1.ButtonLogin_Click(Object sender, EventArgs e) in C:\Solutions\Test\TestApp\TestApp\Form1.vb:line 16
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs 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.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at TestApp.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: Oracle.DataAccess.Client.OracleException
DataSource=""
ErrorCode=-2147467259
Message=The provider is not compatible with the version of Oracle client
Number=-11
Procedure=""
Source=Oracle Data Provider for .NET
StackTrace:
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleConnection..cctor()
InnerException:
======================


The code is
=======================
Dim str_ConnectionString As String = Nothing
Dim obj_OracleConnection As OracleConnection = Nothing

str_ConnectionString = "User ID=" + TextBoxUserID.Text + ";Password=" + TextBoxPassword.Text + ";Data Source=" + TextBoxDataSource.Text
obj_OracleConnection = New OracleConnection(str_ConnectionString)

Try
obj_OracleConnection.Open()
MessageBox.Show("Connected. Server=" + obj_OracleConnection.ServerVersion)

Catch ex As Exception
MessageBox.Show(ex.Message)

Finally
obj_OracleConnection.Close()
obj_OracleConnection.Dispose()
End Try
======================
 
Did you actually read the information you posted? It's telling you exactly what the problem is.
Message=The provider is not compatible with the version of Oracle client
 
Back
Top