1 Reply Latest reply: Mar 26, 2014 8:15 AM by d3482861-ab18-4b94-8a46-04030586a682 RSS

    Problem connecting via Ole DB

    RamaniNJ

      I was able to download and install version 12.1.0.1.0 on a wintel running 64bit Windows 7 Professional. I am able to launch SQL Plus and SQL Developer to log onto the database I created as part of the install. When I tried to connect to the Database within MS Visual Studio 12, I did the following: 1. Chose Oracle Database as the DataSource. 2. Chose .Net Framework Data Provider for OLE DB. 3. Specified the database server IP, user id and Password. 4. The connection string says "Provider:MSAORA; Data source=10.10.20.52;Persist Security Info=True;User ID=pvm" 5. When I clicked on Test connection, I get the error message, "Oracle Client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle version 7.3.3. or later client software installation. Problem 2a: 1. In the 2nd step above, I chose .Net Framework Data Provider for Oracle 2. Now, the test string is changed to "Data Source=10.10.20.52;Persist Security Info=True;User ID=pvm" 3. When I click in Test Connection, I get the error message, "Attempt to load Oracle client libraries threw a BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed" I see that it's using the Microsoft Ole DB driver; but my oracle install included Oracle's Ole DB drivers as well.  How do I resolve this issue? venki

        • 1. Re: Problem connecting via Ole DB
          d3482861-ab18-4b94-8a46-04030586a682

          Hi Venki,

          This may not be the answer your looking for, but worth a look I guess to rule out any problems with the oracle client..

           

          if you can connect via TNS name, which I guess you can with sqlplus.

          Create a new subroutine and include the following.. (sample in VB / you can convert it to C# using online tools)

           

          Imports System.Data.OracleClient

          if the namespace gives you problem, make sure you have the  oracle .net client driver installed.

           

           

          private sub DataConnection()

           

               Dim oraConn As String = "User Id=username;Password=passwd;Data Source=TNSname;"

               Dim orac As OracleConnection = New OracleConnection(oraConn)

              

          try

               dim sql as string  = "select something from table where ID = 2 "

                      orac.Open()

                      Dim rsb As OracleDataReader

                      Dim orCommand As OracleCommand

                      orCommand = New OracleCommand(sql, orac)

                      rsb = orCommand.ExecuteReader()

                      While rsb.Read()

           

                ' do something with the data.

           

                      End While

                      rsb.Close()

                      orCommand = Nothing

                      orac.Close()

           

          catch ex as exception

           

          end try

           

          let us know how you get on.

           

           

           

           

          end sub