Oracle.DataAccess.dll connectivity failed for web applications

I am developing web application in asp.net, we are using Oracle 11g 64 bit server as back end, connecting through the following code fails to connect:

I am using Visual Studio 2012(4.5) under 64 bit compilation environment,

What I've tried :

I tried to connect oracle data access, dll which will perform Oracle db connectivity, it connects at windows applications, while trying with following code on web applications it fails:

Imports System.Data
Imports Oracle.DataAccess.Client ' ODP.NET Oracle managed provider
Imports Oracle.DataAccess.Types

Public Class RafiqClass
    Public Sub Intm()
        Try
            Dim oradb As String = "Password=valuesol;Persist Security Info=True;User ID=system;Data Source=orcle"
            Dim conn As New OracleConnection(oradb)
            conn.Open()
            Dim cmd As New OracleCommand
            cmd.Connection = conn
            cmd.CommandText = "select department_name from departments where department_id = 10"
            cmd.CommandType = CommandType.Text
            Dim dr As OracleDataReader = cmd.ExecuteReader()
            dr.Read()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
End Class

I already added reference, library creation for this dll, but still it's not working with respect to web application

Whats error which occurs:

Attempt to load oracle client libraries threw badimageformatexception. This problem will occur when running in 64 bit with the 32 bit oracle client components installed.

Any guidance to solve this problem are welcome.

thanks in advance

Upvotes: 1

Views: 3315

Answers (2)

user2905764
user2905764

Reputation:

Sorry can't comment so I m posting as answer. your ODP.Net libraries are 32 bit and the web apps will required 64-bit to work on. On windows environment you can run 64bit as well as 32bit apps on a 64 bit environment , but in an IIS you must need same environment libraries to work.

http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html

Upvotes: 3

Related Questions