Chapter 2 Programming Information


Handling restrictions, limitations, and deviations from JDBC standards

This section discusses restrictions and limitations that apply to jConnect, including how the jConnect implementation of JDBC deviates from the JDBC 1.x and 2.0 standards. The following topics are covered:

Making adjustments for multithreading

If several threads simultaneously call methods on the same Statement instance, CallableStatement, or PreparedStatement--which we do not recommend-- you have to manually synchronize the calls to the methods on the Statement; jConnect does not do this automatically.

For example, if you have two threads operating on the same Statement instance--one thread sending a query and the other thread processing warnings--you have to synchronize the calls to the methods on the Statement or conflicts may occur.

Using ResultSet.getCursorName( )

Some JDBC drivers generate a cursor name for any SQL query so that a string can always be returned. However, jConnect does not return a name when ResultSet.getCursorName( ) is called, unless you either

If you do not call setFetchSize( ) or setCursorName( ) on the corresponding Statement, or set the SELECT_OPENS_CURSOR connection property to true, null is returned.

According to the JDBC 2.0 API (chapter 11, "Clarifications"), all other SQL statements do not need to open a cursor and return a name.

For more information on how to use cursors in jConnect, see "Using cursors with result sets".

Using setLong( ) with large parameter values

Implementations of the PreparedStatement.setLong( ) method set a parameter value to a SQL BIGINT datatype. Most Adaptive Server databases do not have an 8-byte BIGINT datatype. If a parameter value requires more than 4 bytes of a BIGINT, using setLong( ) may result in an overflow exception.

Using COMPUTE statements

jConnect does not support computed rows. Results are automatically cancelled when a query contains a computed row. For example, the following statement is rejected:

SELECT  name FROM sysobjects 
WHERE type="S" COMPUTE COUNT(name)

To avoid this problem, substitute the following code:

SELECT name from sysobjects WHERE type="S"
SELECT  COUNT(name) from sysobjects WHERE type="S"

Executing stored procedures

 


Copyright © 2001 Sybase, Inc. All rights reserved.