1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
Oracle OCCI demo
================
This demo shows how to implement an Ice server that uses Oracle
through its Oracle C++ Call Interface (OCCI) API.
It is a fairly simple demo that illustrates how to:
- Map relational data to Ice objects, in particular convert between
Ice and OCCI types.
- Use an OCCI pool to provide Oracle connections to Ice requests.
- Use an Ice servant locator.
Building the demo
-----------------
OCCI is only available for some C++ compilers. Make sure to select a
platform and C++ compiler supported by both Ice and OCCI.
- Setup an Oracle database with the traditional EMP/DEPT schema.
With Oracle server 10.2 and 11.1, the corresponding SQL script is
$ORACLE_HOME/rdbms/admin/utlsampl.sql.
- Ensure that your user (by default, scott) has the CREATE VIEW
privilege.
- Create object types and views using the provided createTypes.sql
script. For example:
% sqlplus /nolog
SQL> @createTypes.sql
This script assumes that you can connect to your database with
'scott/tiger@orcl'. If you need another connect-string, edit
createTypes.sql.
- Oracle's ott utility needs to connect to the database in order to
generate code from the file 'DbTypes.typ'. The default connect-
string is "scott/tiger@orcl". If this is not appropriate, edit the
corresponding Makefile target, or the Custom build rule for
Visual Studio projects.
- Set the environment variable ORACLE_HOME to point to your Oracle
installation home directory.
- On Windows with Visual Studio 2005 Project Files, add the
following directories to your Visual C++ environment:
- Include files: $(ORACLE_HOME)\oci\include
- Library files: $(ORACLE_HOME)\oci\lib\msvc\vc8
$(ORACLE_HOME)\oci\lib\msvc
(make sure to list msvc\vc8 before msvc)
- Executable files:
$(ORACLE_HOME)\oci\lib\msvc\vc8;$(ORACLE_HOME)\bin
- On Windows, when using nmake Makefiles, please review
Makefile.mak.
- Then build as usual.
Running the demo
----------------
- Review the Oracle properties in the config.server file.
You may need to change them to connect to your Oracle instance.
- Start the server:
$ server
- Start the client in a separate window:
$ client
|