Actually, Oracle Database 10g (64-bit version) cannot be installed on either Windows 7 x64 or Windows Server 2008R2, but we can “hack” the installer configuration to allow this installation scenario. However, Oracle said they didn’t recommend this “hacking” story. They said we have to use Oracle Database 11g instead. But, one of my big customer still use Oracle Database 10g, they don’t have license for 11g, and I have to install 10g in my development machine.
- First of all, copy the installation files to hard disk, let’s say we copy those files to c:\oracle10g
- Open folder install, open oraparam.ini using notepad, go to line 32, we will find this line:
Change that line to:
#Windows=5.0,5.1,5.2,22.214.171.124 As you may know Windows 5.1 is well known as Windows XP, 5.2 is Windows Server 2003, 6.0 is Windows Vista/Windows Server 2008, and 6.1 is Windows 7/Windows Server 2008R2.
- Save oraparam.ini
- Open folder stage\prereq\db, open refhost.xml, at line 30, add this line:
- Save refhost.xml
- Back to the root folder, run setup.exe, Oracle Universal Installer should said that your operating system is passed the requirement.
- Install the Oracle Database as usual
While installing, we will be notified that Database Control (Enterprise Manager) service cannot be started. Don’t worry, we do not need this in our development machine. We still can use command line based, sqlplus, to control the database.
OK, so far so good, let’s try to build the database application using Visual Studio.
In my experiment, I used Visual Studio 2008, I tried to create simple ASP.NET 3.5 Web Site, and add reference to Microsoft Oracle Client library. This .NET library is bundled with .NET Framework (Version 2.0 or 4.0), you can find System.Data.OracleClient in GAC. Write this code:
var conn = new System.Data.OracleClient.OracleConnection();
conn.ConnectionString = "user id=hr;password=hr;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=ORCL)))";
As you see, we have to use “long version” of data source value. It seems we can’t use only TNS name.
Then, I ran the web site…..and BOOM!!! ASP.NET threw an exception with message that Oracle Client 8.1.3 or higher is required.
It seems .NET Framework Oracle Client cannot use Oracle Database 10g x64 library we already installed.
Then….I tried to download and install Oracle Client 10g, the installer will add it’s bin folder to PATH environment variable. We have to move this folder to the last order of the PATH variable:
- Open up System Properties from Control Panel, go to Advanced tab, open Environment Variables window.
- At System Variables, find PATH variable, move Oracle Client’s bin folder to the last order of the PATH values.
- Click OK to save changes.
- Restart Windows to ensure our changes would be applied.
Re-open and re-run our ASP.NET Web Site code, the error message we saw before should be vanished and the connection object can be opened successfully.
You may have question, why do I not use ODP.NET instead?
Yes, I have tried it also. I have tried to use ODP.NET DLL, Oracle.DataAccess.dll (64 bit version), but I still can’t connect to the database from my .NET code. If you have any suggestion how to use ODP.NET 10g in .NET application, please let me know.