32-bit and 64-bit support for external routines
Support for 32-bit and 64-bit external routines is determined by the specification of one of the following two clauses in the CREATE statement for the routines: FENCED clause or NOT FENCED clause.
The routine-body of an external routine is written in a programming language and compiled into a library or class file that is loaded and run when the routine is invoked. The specification of the FENCED or NOT FENCED clause determines whether the external routine runs in a fenced environment distinct from the database manager or in the same addressing space as the database manager which can yield better performance through the use of shared memory instead of TCPIP for communications. By default routines are always created as fenced regardless of the other clauses selected.
The following table illustrates the database support for running fenced and unfenced 32-bit and 64-bit routines on 32-bit and 64-bit database servers that are running the same operating system.
| Bit-width of routine | 32-bit server | 64-bit server |
|---|---|---|
| 32-bit fenced procedure or UDF | Supported | Supported 1 |
| 64-bit fenced procedure or UDF | Not supported 3 | Supported |
| 32-bit unfenced procedure or UDF | Supported | Supported 1,2 |
| 64-bit unfenced procedure or UDF | Not supported 3 | Supported |
- Running a 32-bit routine on a 64-bit server is not as fast as running a 64-bit routine on a 64-bit server.
- 32-bit routines must be created as FENCED and NOT THREADSAFE to work on a 64-bit server.
- 64-bit applications and routines cannot be run in 32-bit addressing spaces.
The important thing to note in the table is that 32-bit unfenced procedures cannot run on a 64-bit database server. If you must deploy 32-bit unfenced routines to 64-bit platforms, remove the NOT FENCED clause from the CREATE statements for these routines before you catalog them.