Creation of Pro*C development/test environment on Windows XP
- Download and install Visual C++ 2005 Express Edition (or newer version if available, version 2008 was in beta at this time).
- Download and install the service pack 1 of Visual C++ 2005 Express (possibly not needed if you are using 2008 version).
- Download and install SDK for Visual Developer. You don't have all the C header files you need if you don't have this (ie windows.h - how weird is that).
- Download Oracle client from Technet (technet.oracle.com). I used 10R2 client, and during the install choose to do a custom install, and from the install list just selected the Oracle Programmer check box.
- Once this has installed, you need to install the Oracle demo pack. This gives you some precompiler demos and the compile and link batch files. You would struggle to get started without this. So download the Companion pack (on the same page as the Client software) and start the install. You need to choose the correct install option, for the 10gR2 install you need to select the middle choice, in our case it said "Oracle Database 10g products 10.2.0.1.0". The important point is that it has to be installed into the client Oracle home that was created in option 4.
- That completes the basic software install, we now need to get into the nitty gritty.
- Start a command session START Button - RUN- cmd
- Set the ORACLE_HOME environment variable,
set ORACLE_HOME=c:\oracle\product\10.2.0\client_1
- Change directory to %ORACLE_HOME%/precomp/proc/demo/proc
- In this directory is the makefile and it is called pcmake.bat. We will need to edit it to make it work.
- Also in this directory are a number of subdirectories which contain pro*c demos. Change directory to cpdemo1 which we will use as our choice to test if things are working.
- Before you start to compile you need to run a setup command script for the Visual C++. You need to run, vcvars32.bat. It is located in c:\program files\microsoft visual studio 8\VC\bin. It needs to be run from the command file.
- So to do this set MSVCDIR="c:\program files\microsoft visual studio 8\VC" then run %MSVCDIR%\bin\vcvars32.bat
- Once have run this you can try to run the makefile.
- ..\pcmake cpdemo2
- At this stage we found that there were two file missing that were needed. The first was oci.lib which should have been in the Oracle directory structure, the second was uuid.lib which should have been in the microsoft visual C directory structure.
- I'm not sure why these files are missing, the first should be in the %ORACLE_HOME%\oci\lib\msvc directory. I ended up going to the database install on one of our Windows servers and finding the oci.lib file there and copying it to the appropriate directory on the WindowsXP platform.
- The other file was more difficult to track down. I ended up installing the Visual C express 2008 on another PC, the uuid file was there where it ought to be. I copied it to the %MSVCDIR%\lib directory.
- Edit the %ORACLE_HOME%\precomp\admin\pcscfg.cfg file and add the line INCLUDE="c:\program files\microsoft platform SDK for windows 2003 R2\include". Even though you installed the 2005 expres edition of Visual C, when you install the SDK it seems you get the Windows Server 2003 SDK, even though we are using XP !! If you get a different directory structure you will need to change the above for the appropriate directroy names.
- The final change I found that I had to do was to edit the pcmake.bat file. Towards the bottom there is a label called clink. The line below this that starts "cl" is the C compiler command. You need to add in an extra include directory in this line to find the SDK. The text to add is -I"c:\program files\microsoft platform SDK for windows server 2003 R2\include" I added it in the middle of the line towards the end of the other nclude commands.
- OK so now we can run the pcmake command
- ..\pcmake.bat cpdemo1
- Mine now compiles to produce cpdemo1.exe.
- In order to run the cpdemo1 we need to do a couple of things, firstly set up the tnsnames .ora amd sqlnet.ora for this oracle home.
- Secondly edit cpdemo1.pc and see where the line #define CONNINFO="hr/hr" defines the connection information. If you have a schema called HR which has a table called employees then that is fine. If not you need to make one or alternatively change the connection info to another user. Add a connect string as well if you need it.
- Using sqlplus, Create table employees (empno number(4)); will create the table for you. This C code just does a count(*), so you need a few data lines.
- insert into employees values(2222); run a few times will do this, don't forget to do a commit.
- OK, recompile the cpdemo.pc again, with the new connection info (no need if you didn;t need to change it).
- Now you should just be able to execute it, type cpdemo1
- OK that's it.