Introduction
I recently had to set-up a new development environment for a .NET application
consuming an Oracle Database and found out that it wasn’t that easy, so I
thought I’d share how I did it.
Warning
This is just a tip, I used it on my dev machine and it worked, I did not test
this any further and there’s absolutely no warranty, express or implied. If
anything should happen, I’m just saying I told you and I cannot be held
responsible.
Prerequisites
I downloaded and installed a free Oracle Database Express Edition.
The
11g Release 2 is available here: http://www.oracle.com/technetwork/products/express-edition/downloads/index.html. Yet,
in this case I had to install a 10g in 32-bit which can’t be found on OTN
anymore…..except on a Japanese OTN page?!!
If you need the Oracle Database 10g Express Edition (x86) as I did here’s
the link: http://www.oracle.com/technetwork/jp/database/express-edition/downloads/102xewinsoft-089442-ja.html
Installing the Server
Nothing special here: install OracleXE.exe,
keep everything by default:
- installation directory: C:\oraclexe
- default port: 1521
- configure the SYS or SYSTEM account
Once installed, an
administration web page should start. Check that everything runs fine, if so,
you’re done, now let’s prepare it for the .NET world!
Installing OCI and ODP.NET
Oracle Call Interface (OCI) is the basic
and compulsory method to access Oracle using a client. On top of OCI, we’ll need
the Oracle Data Access Components (ODAC). Both OCI and ODAC are a set of dlls
and that are shipped as a ZIP, available on Oracle’s web site (http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html).
In my case I specifically needed the ODAC1110621Xcopy.zip, in your case just
be careful to use an ODAC version matching your Oracle Database version and
bitness.
Then here’s how I configured my environment:
- I created a “C:\oracle” just like OracleXE did,
- I extracted the content of my ODAC1110621Xcopy.zip archive in this
directory,
- I removed the path “C:\oraclexe\app\oracle\product\10.2.0\server\bin” from
myPATH environment variable…
- …and added the “C:\oracle\instantclient_11_1” in the PATH so my OCI dlls are
used,
- I copied the Oracle.DataAccess.dll that is in
“C:\oracle\odp.net20\odp.net\bin\2.x\”in “C:\oracle\instantclient_11_1”,
- I removed all Oracle.DataAccess.dll from the GAC so I’ll be sure my .NET
apps we’ll always use the Oracle.DataAccess.dll they reference,
- I copied the OraOps11w.dll contained in the “C:\oracle\bin”
in“C:\oracle\instantclient_11_1”
Installing SQL Developer
- Download SQL Developer from OTN:
http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html
- Extract and place the sqldeveloper directory in “C:\oracle”
- Launch SQL Developer, and it should run nice and easy
Point of interest
It is even easier with CodeFluent Entities.