Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-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
 

Configuring JDBC Options

Most JDBC drivers support the run-time configuration of various options to customize driver operation to meet user needs. TopLink provides direct support (in API and TopLink Workbench) for many of the most important options, as this section describes, as well as more advanced options (see "Configuring Advanced Options")

You can also configure additional options by specifying properties (see "Configuring Properties").


Note:

Not all drivers support all JDBC options. Selecting a combination of options may result in different behavior from one driver to another. Before selecting JDBC options, consult your JDBC driver documentation.

Using TopLink Workbench

To specify the JDBC options for a relational server (or database) session login, use this procedure:

  1. Select a relational server (or database) session in the Navigator. Its properties appear in the Editor.

  2. Click the Login tab. The Login tab appears.

  3. Click the Options subtab. The Options subtab appears.

    Figure 86-5 Login – Options Tab, JDBC Options

    Description of Figure 86-5  follows
    Description of "Figure 86-5 Login – Options Tab, JDBC Options"

Option Description
Queries Should Bind All ParametersFoot 1  Select this option to bind all of the query's parameters
Cache All StatementsFootref 1 When selected, TopLink caches each prepared statement so that when reexecuted, you avoid the SQL preparation time which improves performance.
Byte Array BindingFootref 1 Select this option if you query binary large object (BLOB) data.
Streams for BindingFootref 1 Select this option if you use a JDBC driver that is more efficient at handling BLOB data using java.io.InputStream and java.io.OutputStream.
Native SQL By default, TopLink generates SQL using JDBC SQL grammar. Select this option if you want TopLink to use database specific SQL grammar, for example, if your database driver does not support the full JDBC SQL grammar.
Batch WritingFoot 2  Select this option if you use a JDBC driver that supports sending groups of INSERT, UPDATE, and DELETE statements to the database in a single transaction, rather than individually.

Select JDBC to use the batch writing capabilities of your JDBC driver.

Select TopLink to use the native batch writing capabilities that TopLink provides. Select this option if your JDBC driver does not support batch writing.

String BindingFootref 1 Select this option if you query large java.lang.String objects.

You can configure the maximum String length (default: 32000 characters).


Footnote 1 For more information, see "Parameterized SQL (Binding) and Prepared Statement Caching".

Footnote 2 If you are using the MySQL4 database platform (see "Data Source Platform Types"), use JDBC batch writing (do not use TopLink batch writing). For more information, see "Batch Writing".

Using Java

To enable parameterized SQL and prepared statement caching for all queries, configure at the Login level, as Example 86-10 shows. For more information, see "Parameterized SQL (Binding) and Prepared Statement Caching".

Example 86-10 Parameterized SQL and Binding at the Login Level

databaseLogin.bindAllParameters();
databaseLogin.cacheAllStatements();
databaseLogin.setStatementCacheSize(100);

To enable JDBC batch writing, use Login method useBatchWriting as Example 86-11 shows:

Example 86-11 Using JDBC Batch Writing

project.getLogin().useBatchWriting();
project.getLogin().bindAllParameters();
project.getLogin().setMaxBatchWritingSize(100);