Table of Contents
环境:windows2008R2企业版64位,安装Oracle 11g 64位版服务端。C#3.5开发的b/s系统,32位版。delphi7开发的c/s服务
Oracle 11g 64位版在64位操作系统上连接Oracle的问题和解决方案 BadImageFormatException
同时解决Delphi7.0采用Oledb链接64位oracle11g出现密码不正确的问题。
参考文章:http://blog.darkthread.net/blogs/darkthreadtw/archive/2008/10/19/system-data-oracleclient-requires-oracle-client-software-version-8-1-7.aspx
我的奮鬥-System.Data.OracleClient on Windows 2008 x64
Home Database Mysql Tutorial C#,delphi7在64位操作系统上连接Oracle 11g的问题和解决方案 Ba

C#,delphi7在64位操作系统上连接Oracle 11g的问题和解决方案 Ba

Jun 07, 2016 pm 03:37 PM
64 bit oracle operating system connect

环境:windows2008R2企业版64位,安装Oracle 11g 64位版服务端。C#3.5开发的b/s系统,32位版。delphi7开发的c/s服务 错误提示: Oracle 11g 64位版在64位操作系统上连接Oracle的问题和解决方案 BadImageFormatException 同时解决Delphi7.0采用Oledb链接64位o

环境:windows2008R2企业版64位,安装Oracle 11g 64位版服务端。C#3.5开发的b/s系统,32位版。delphi7开发的c/s服务

错误提示:

Oracle 11g 64位版在64位操作系统上连接Oracle的问题和解决方案 BadImageFormatException

同时解决Delphi7.0采用Oledb链接64位oracle11g出现密码不正确的问题。

 

尝试加载Oracle客户端库时引发BadImageFomatException。如果在安装32位Oracle客户端组件的情况下以64位模式运行,将出现此问题。

错误原因是原来WinXP机子上所安装的OracleInstantClient是32位,所以编译的程序所用的OracleClient也是32位的,从而导致兼容问题。当然,如果在64位操作系统上重新安装64位的Oracle客户端再重新编译程序也是能解决问题的。这里我们介绍一种简单的方法来移植程序。

如果在服务器端安装32位的oracle9i客户端,要注意密码的大小写的问题,9i客户端默认会把密码转换成大写,要特别注意。

 

总之解决问题的方法是:在服务端再安装一个Oracle 11g 32位版的客户端

 

参考文章:http://blog.darkthread.net/blogs/darkthreadtw/archive/2008/10/19/system-data-oracleclient-requires-oracle-client-software-version-8-1-7.aspx

我的奮鬥-System.Data.OracleClient on Windows 2008 x64

自從家中與公司的機器分別改用Vista x64及Windows 2008 x64後,在享受爽快揮霍記憶體之餘,也一併開始體驗在新大陸拓荒的感覺。大部分的高階應用程式,多半可以x86虛擬環境執行,問題不大。但有不少涉及低階處理的程式選擇頓時劇減,例如: RamDisk因為Driver未具備簽章無法使用、能支援x64的免費防毒軟體屈指可數、之前提到重新Survey了DVD燒錄程式...

這些軟體上的短缺咬一咬牙就撐過了,最讓我痛苦的是原本部門大家慣用的ODP.NET 9207完全不支援x64版本,安裝程式根本沒法跑!

Google之後,知道Oracle 10.2g開始Support Vista/Windows 2008 x64,但無奈ORACLE網站不知怎麼,連續好幾天,下載連結都出現HTTP 404。最後終於在兩週後讓我下載到近500M的10204_vista_w2k8_x64_production_client.zip,安裝完成馬上用現有的專案試了一下,結果出現:

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

檢視權限等OK,試了一下重新開機,訊息變了:

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: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B).

似乎是DLL版本不對,但我明明裝的是64bit Oracle Client,.NET程式限定Build for x86 CPU,為什麼跟我說: 在64 Mode下去讀了32bit Oracle Client? 感覺上恰恰相反才對。

反覆測試,忽然發現如果設定Build for AnyCPU或x64就可以順利連上Oracle,唯獨設成x86時會出現上述疑似相反的錯誤。設成x86時去讀取64bit Oracle Client DLL會發生問題,十分合理,只是一開始的錯誤訊息讓我有些迷惑。如果這是問題,那麼是否同時再裝32bit Oracle Client就好? 但,System.Data.OracleClient要如何知道該用32bit或64bit Oracle Client? 我每次都要改Registry或設PATH環境變數來切換使用的Client嗎? 一切的疑問,都要試了才知道!!

找到10203_vista_w2k8_x86_production_client.zip,裝在另一個目錄下(c:\oracle\ora10g vs c:\oracle\ora10g_x86),重新登入讓PATH環境變數中的c:\oracle\oar10g_x86\bin生效,x86就可以跑了。抱著期待的心情切成x64再跑,Yes! 也成功了!! 但這是x64 .NET用32bit Oracle Client的結果嗎?

使用Process Monitor解開了疑惑: System.Data.OracleClient會沿著PATH環境變數的路徑去找oci.dll,在x64下會略過c:\oracle\ora10g_x86\bin\oci.dll,找到c:\oracle\ora10g\bin\oci.dll後連線;x86時則是找到c:\oracle\ora10g_x86\bin\oci.dll就結束尋找,AnyCPU則與x64的行為相同。
(記得之前的PB6連Oracle9嗎? 一樣是用PATH法)

換句話說,OracleClient會依x64/x86決定適當的Oracle Client版本,不必勞煩我去手工切換。因此,如果想在Windows 2008/Vista x64上使用System.Data.Oraclient,最好32bit/64bit兩種10.2+版本的Oracle Client都要裝,並確定PATH變數中二者的bin目錄都有在其中,一切就搞定了。

說來簡單,卻花了我好幾個星期才解決,希望這點心得對其他也在x64叢林中挺進的同胞們有些幫助。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to download okx trading platform How to download okx trading platform Mar 26, 2025 pm 05:18 PM

The OKX trading platform can be downloaded through mobile devices (Android and iOS) and computers (Windows and macOS). 1. Android users can download it from the official website or Google Play, and they need to pay attention to security settings. 2. iOS users can download it through the App Store or follow the official announcement to obtain other methods. 3. Computer users can download the client of the corresponding system from the official website. Always make sure to use official channels when downloading, and register, log in and security settings after installation.

BitMEX Exchange's latest official website entrance BitMEX Exchange's latest official website entrance Mar 21, 2025 pm 06:03 PM

As a veteran cryptocurrency derivatives trading platform, the accuracy of its official website entrance is crucial. Due to rampant phishing websites, misent entry into fake websites can lead to account theft and loss of funds. This article aims to guide users to safely access the BitMEX official website, provide various methods such as trusted cryptocurrency information platforms (such as CoinMarketCap, CoinGecko), official social media, verification of existing addresses and official support channels, and emphasizes the use of security measures such as two-factor verification, regular password changes and use of security software to help users effectively avoid risks and ensure account security.

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

How to operate Zookeeper performance tuning on Debian How to operate Zookeeper performance tuning on Debian Apr 02, 2025 am 07:42 AM

This article describes how to optimize ZooKeeper performance on Debian systems. We will provide advice on hardware, operating system, ZooKeeper configuration and monitoring. 1. Optimize storage media upgrade at the system level: Replacing traditional mechanical hard drives with SSD solid-state drives will significantly improve I/O performance and reduce access latency. Disable swap partitioning: By adjusting kernel parameters, reduce dependence on swap partitions and avoid performance losses caused by frequent memory and disk swaps. Improve file descriptor upper limit: Increase the number of file descriptors allowed to be opened at the same time by the system to avoid resource limitations affecting the processing efficiency of ZooKeeper. 2. ZooKeeper configuration optimization zoo.cfg file configuration

How to do Oracle security settings on Debian How to do Oracle security settings on Debian Apr 02, 2025 am 07:48 AM

To strengthen the security of Oracle database on the Debian system, it requires many aspects to start. The following steps provide a framework for secure configuration: 1. Oracle database installation and initial configuration system preparation: Ensure that the Debian system has been updated to the latest version, the network configuration is correct, and all required software packages are installed. It is recommended to refer to official documents or reliable third-party resources for installation. Users and Groups: Create a dedicated Oracle user group (such as oinstall, dba, backupdba) and set appropriate permissions for it. 2. Security restrictions set resource restrictions: Edit /etc/security/limits.d/30-oracle.conf

How to download kraken exchange How to download kraken exchange Mar 27, 2025 pm 04:21 PM

Want to experience a safe and reliable Kraken exchange? This tutorial details how to download the Kraken App (iOS & Android) and access the web version, and reminds everyone to pay attention to safety. Be sure to download it from the official channel, enable two-factor authentication, and protect account security.

XBIT Decentralized Exchange APP download recommendation XBIT Decentralized Exchange APP download recommendation Mar 31, 2025 pm 08:21 PM

This article introduces in detail the download and installation steps of the XBIT Exchange mobile APP, including four steps: accessing the official website (https://www.xbit.com/), downloading the installation package of the corresponding operating system (iOS or Android), installing software (including the installation methods of iOS and Android systems), and finally opening the app and registering/logging in. Please be careful to visit the official website to avoid malware and phishing websites, and select the installation package according to your own system version. If you have any questions, please contact XBIT Exchange online customer service.

Is Debian Strings worth using Is Debian Strings worth using Apr 02, 2025 am 08:24 AM

Regarding the choice of Debian system, this article will explore the advantages of Debian system and help you determine whether it is suitable for your needs. The image shows the missing search results related to DebianStrings, which prompts us to look at the Debian system from a broader perspective. Debian Community & Stability: Debian is known for its large and active open source community, which means you can easily access a large amount of documentation, tutorials, and community support to quickly resolve issues you encounter. The stability of the system is also a highlight of Debian, especially in the server environment, which is much more stable than other distributions. Debian vs. Ubuntu: Compared with Ubuntu, Debian

See all articles