blob: 1244518599730d1674f7ff42cff66afbde77b8bb (
plain)
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
80
81
82
83
84
85
86
87
|
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.
OCCI oracle drivers are available at:
http://www.oracle.com/technetwork/database/occidownloads-083553.html
- Setup an Oracle database with the traditional EMP/DEPT schema.
With Oracle server 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 2010 Project Files, add the
following directories to your Visual C++ environment:
- Include files: $(ORACLE_HOME)\oci\include
- Library files: $(ORACLE_HOME)\oci\lib\msvc\vc10
$(ORACLE_HOME)\oci\lib\msvc
(make sure to list the driver folder before lib\msvc)
- Executable files:
$(ORACLE_HOME)\oci\lib\msvc\vc10;$(ORACLE_HOME)\bin
- If OCCI driver isn't installed in the standard location,
update Library and Executable files to match your installation
directories
- 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
|