日期:2014-05-17  浏览次数:20945 次

程序连接64位系统上的32位oracle的问题
我服务器是安装64位windows20003 ,数据库为32位的oracle11g,我的程序通过客户端(客户端为32位oracle)可以正常连接,但是程序放到服务器上,就出现如下错误:
System.InvalidOperationException: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed. ---> System.BadImageFormatException: 试图加载格式不正确的程序。 (Exception from HRESULT: 0x8007000B)
  at System.Data.Common.UnsafeNativeMethods.OCILobCopy2(IntPtr svchp, IntPtr errhp, IntPtr dst_locp, IntPtr src_locp, UInt64 amount, UInt64 dst_offset, UInt64 src_offset)
  at System.Data.OracleClient.OCI.DetermineClientVersion()
  --- End of inner exception stack trace ---
  at System.Data.OracleClient.OCI.DetermineClientVersion()
  at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
  at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
  at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
  at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
  at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
  at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
  at System.Data.OracleClient.OracleConnection.Open()
一直没有找的好的办法,请高人指点,谢谢。

------解决方案--------------------
64 位 Oracle 只能运行于 64 位 Linux 之上。windows是不是也这样呀??