Trouble with Visual Studio 2008 and Oracle.DataAccess.dll on WIN7 x64
698289Dec 22 2009 — edited Dec 23 2009I installed Win7 (x64) on my computer and everything has worked great except I cannot get my Visual Studio 2008 application to connect to the Oracle 10g database. My previous configuration was Vista (x32) and I had no issues connecting and retrieving Oracle data. From as far as I can tell I have used the same Oracle Universal Installer application and the database has not changed at all. On my server I have applications I previously created working fine using the Oracle.DataAccess.dll connector (version 10.2.0.100 - Oracle Data Provider for .NET) and I have double checked the version installed on my laptop to be the same.
When I attempt to process the application in debug mode I get an error “A first chance exception of type 'Oracle.DataAccess.Client.OracleException' occurred in Oracle.DataAccess.dll” and the code stops on the line conn.Open() with the following exception detail:
Oracle.DataAccess.Client.OracleException was unhandled
Message=""
StackTrace:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleConnection.Open() at ConsoleApplication1.Module1.ReadContactDistributionOracle() in C:\Users\RLessor\Documents\Visual Studio 2008\ACTEST\ConsoleApplication1\ConsoleApplication1\Module1.vb:line 37 at ConsoleApplication1.Module1.Main() in C:\Users\RLessor\Documents\Visual Studio 2008\ACTEST\ConsoleApplication1\ConsoleApplication1\Module1.vb:line 19 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 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:
I am at wits end as this should not be all that difficult to debug but I have now spent two days and have not gotten anywhere hence my reaching out for assistance. The test application code is below.
Imports Oracle.DataAccess.Client ' ODP.NET Oracle managed provider
Module Module1
Dim strOracleSQLStatement As String
Dim strJobNumber As String
Dim count As Long
Sub Main()
strOracleSQLStatement = "SELECT jcdt_job_code,jcdt_phs_code FROM da.jcdetail WHERE jcdt_job_code='12230'" '= '" & strJobNumber
Call ReadContactDistributionOracle()
End Sub
Sub ReadContactDistributionOracle()
Dim oradb As String = "Data Source=(DESCRIPTION=" _
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=pclinux-db1)(PORT=1521)))" _
+ "(CONNECT_DATA =(SERVICE_NAME=TEST)));" _
+ "User Id=test;Password=qwerty123;"
Dim conn As New OracleConnection(oradb)
conn.Open()
Dim cmd As New OracleCommand
cmd.Connection = conn
cmd.CommandText = strOracleSQLStatement
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
While dr.Read()
count = count + 1
Console.WriteLine("Record " & vbTab & dr.Item("jcdt_job_code") & vbTab & dr.Item("jcdt_phs_code") & vbTab & count)
End While
Stop
dr.Dispose()
cmd.Dispose()
conn.Dispose()
End Sub
End Module