Skip Headers
Oracle® Application Server TopLink Application Developer's Guide
10g Release 2 (10.1.2)
Part No. B15901-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Database Platforms

OracleAS TopLink communicates with databases using Structured Query Language (SQL). Because each database platform uses its own variation on the basic SQL language, OracleAS TopLink must adjust the SQL it uses to communicate with the database to ensure that the application runs smoothly.

This section describes OracleAS TopLink support for:

JDBC-SQL and Native SQL

By default, OracleAS TopLink accesses the database using JDBC-SQL and automatically performs the conversions between Java types and database types. OracleAS TopLink provides the conversions listed in Table 5-1 automatically.

Table 5-1 JDBC-SQL Conversion Types

Class Oracle Type DB2 Type dBase Type Sybase Type Microsoft Access Type
java.lang.Boolean NUMBER SMALLINT NUMBER BIT default 0 SHORT
java.lang.Byte NUMBER SMALLINT NUMBER SMALLINT SHORT
java.lang.Byte[] LONG RAW BLOB BINARY IMAGE LONGBINARY
java.lang.Integer NUMBER INTEGER NUMBER INTEGER LONG
java.lang.Long NUMBER INTEGER NUMBER NUMERIC DOUBLE
java.lang.Float NUMBER FLOAT NUMBER FLOAT(16) DOUBLE
java.lang.Double NUMBER FLOAT NUMBER FLOAT(32) DOUBLE
java.lang.Short NUMBER SMALLINT NUMBER SMALLINT SHORT
java.lang.String VARCHAR2 VARCHAR CHAR VARCHAR TEXT
java.lang.Character CHAR CHAR CHAR CHAR TEXT
java.lang.Character[] LONG CLOB MEMO TEXT LONGTEXT
java.math.BigDecimal NUMBER DECIMAL NUMBER NUMERIC DOUBLE
java.math.BigInteger NUMBER DECIMAL NUMBER NUMERIC DOUBLE
java.sql.Date DATE DATE DATE DATETIME DATETIME
java.sql.Time DATE TIME CHAR DATETIME DATETIME
java.sql.Timestamp DATE TIMESTAMP CHAR DATETIME DATETIME

OracleAS TopLink provides the required customization by enabling you to specify your database platform. OracleAS TopLink provides specific support for the following platforms:

  • Oracle databases

  • IBM DB2

  • IBM DBase

  • IBM Cloudscape

  • IBM Informix

  • Microsoft Access

  • Microsoft SQL Server

  • Sybase SQL Server

  • JDBC

  • PointBase databases

Specify your database platform in the login element of the sessions.xml file or the login section of your Java project configuration file (project.java). If you set your database platform in OracleAS TopLink Mapping Workbench, then OracleAS TopLink Mapping Workbench and the OracleAS TopLink Sessions Editor manage the database platform configuration for you automatically.

Example 5-1 Specifying an Oracle Database Platform in the sessions.xml File

For clarity, the code that sets the platform class is bold in this example.

<session>
  ...
  <login>
    ...
    <platform-class>
        oracle.toplink.internal.databaseaccess.OraclePlatform
    </platform-class>
    ...
  </login>
...
</session>

Example 5-2 Specifying an Oracle Database Platform in Java

project.getLogin().useOracle();

Custom Platforms

You can specify a custom database platform for your OracleAS TopLink application. Custom platform support enables you to use a database when OracleAS TopLink has no predefined platform.

To enable custom database platform support, create a new platform class that extends one of the existing platform classes, and call the class at runtime by referencing it in the session configuration file (the sessions.xml file), as Example 5-1 illustrates.