2 Replies Latest reply on Dec 23, 2009 5:26 PM by 698289

    Trouble with Visual Studio 2008 and Oracle.DataAccess.dll on WIN7 x64

      I 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 - 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
      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()

      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)))" _
      + "User Id=test;Password=qwerty123;"

      Dim conn As New OracleConnection(oradb)
      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



      End Sub
      End Module
        • 1. Re: Trouble with Visual Studio 2008 and Oracle.DataAccess.dll on WIN7 x64
          Assuming you installed Oracle 64 bit?
          if so, make sure you have an Oracle Client 32 bit installed as well.
          I assume Visual Studio is a 32 bit app (at least it shows devenv.exe *32 on my 64 bit box),
          so it needs a 32bit oci.dll to connect to your Oracle server.

          If you have installed (as I did) Oracle 64, it has installed a 64 bit version of oci.dll (that is what I think happened on my box).
          So I installed Oracle 11g Client for 32 bit...and made sure the PATH environment variabel etc, pointed to that installation first.
          I also need to copy the tnsnames.ora from the Oracle installation folder to the Oracle client (on my box in C:\Oracle\Instant_Clients\instantclient_11_1_x86\network\admin).

          So for me, my 32 bit app can connect to Oracle, although I am not using it from within Visual Studio.
          Hope this will help you out a bit.

          • 2. Re: Trouble with Visual Studio 2008 and Oracle.DataAccess.dll on WIN7 x64
            I have reviewed your notes and have attempted all of the above and still no go. I have a call into Oracle to see if this is truly possible as three days of trying everything is way to long. What is killing my team is we have had and continue to have success on another WIN7 x64 box using the same installation software media for Oracle but we do not see anything that is different after the installs with the exception my connections fail.