Skip Headers

# Using the Oracle JDBC Thin Driver

Previous

Next

When using the Oracle JDBC thin driver, TopLink is responsible for acquiring the LOB locator before writing the value. You can use a type conversion mapping (see "Configuring a Type Conversion Converter") to retrieve the locator during a commit operation.

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

1. Use a type conversion mapping to map the attributes of a TopLink descriptor to a LOB value. Example: Mapping a BLOB in TopLink Workbench shows a type conversion mapping to a `BLOB` value in TopLink Workbench. Example: Mapping a BLOB in TopLink Workbench shows the Java code for the same mapping.

   Mapping a BLOB in TopLink Workbench

   Description of the illustration blob.gif

   Mapping a BLOB in Java Code

       TypeConversionMapping pictureMapping = new TypeConversionMapping();
       pictureMapping.set.AttributeName("picture");
       pictureMapping.setFieldName("IMAGE.PICTURE");
       pictureMapping.setFieldClassification(java.sql.Blob.class);
       descriptor.addMapping(pictureMapping);

2. Acquire the DatabaseLogin from the session.

       DatabaseLogin login = session.getLogin();

3. Configure a platform that provides locator support.

   - For Oracle8i, use the `oracle.toplink.oraclespecific.Oracle8Platform` class:

         login.usePlatform(new Oracle8Platform());

   - For Oracle9i Database Server, use the `oracle.toplink.oraclespecific.Oracle9Platform` class:

         login.usePlatform(new Oracle9Platform());

   - Oracle Database 10g, use the `oracle.toplink.oraclespecific.Oracle10Platform` class:

         login.usePlatform(new Oracle10Platform());

   In TopLink Workbench, select the appropriate platform in the Database editor.

   Selecting Database Platform in TopLink Workbench

   Description of "Selecting Database Platform in TopLink Workbench"