Skip Headers

# Using the Oracle JDBC OCI Driver or Server Driver

Previous

Next

When using the Oracle JDBC OCI or Server driver, the driver is responsible for acquiring the LOB locator before writing the value–not TopLink. You can use any TopLink mapping type to read and write a `LOB` value.

Use this procedure to map LOB values using the Oracle JDBC OCI driver:

1. Use any mapping type to map the attributes of a TopLink descriptor to a LOB value. Example: Mapping a BLOB with a Direct-To-Field Mapping shows an example of a direct-to-field mapping to a `BLOB` value.

   Mapping a BLOB with a Direct-To-Field Mapping

       DirectToField pictureMapping = new DirectToField();pictureMapping.setAttributeName("picture");pictureMapping.setFieldName("IMAGE.PICTURE");descriptor.addMapping(pictureMapping);

2. Acquire the DatabaseLogin from the session.

       DatabaseLogin login = session.getLogin();

3. Configure the parameter bindings for the specific LOB value:

4. - For `BLOB` values, enable byte array binding to ensure that byte arrays are bound (in the event that `shouldBindAllParamters` is false) and enable the streams for binding to ensure that stream binding is used for byte arrays. Example: Configuring Parameter Bindings in TopLink Workbench shows configuring the parameter bindings in TopLink Workbench. Example: Configuring Parameter Bindings in Java Code shows configuring the parameter bindings in TopLink Workbench.

     Configuring Parameter Bindings in TopLink Workbench

     Description of the illustration byte_array.gif

     Configuring Parameter Bindings in Java Code

         login.setUsesByteArrayBinding(true);
         login.setUsesStreamsForBinding(true);

   - For `CLOB` values, enable string binding to ensure that long string values (more than 255 characters) are bound as character streams. Example: Configuring String Binding in TopLink Workbench shows configuring string binding in TopLink Workbench. Example: Configuring String Binding in Java Code shows configuring string binding in TopLink Workbench.

     Configuring String Binding in TopLink Workbench

     Description of the illustration strngbinding.gif

     Configuring String Binding in Java Code

         login.useStringBinding();