ASA Programming Guide
JDBC Programming
JDBC overview
JDBC in the database features
This section describes how to access JDBC 2.0 features from databases initialized with JDK 1.1 support. For many purposes, a better solution is to upgrade your version of Java in the database to 1.3.
For databases initialized with JDK 1.1 support, the sybase.sql.ASA package contains features that are part of JDBC 2.0. To use these JDBC 2.0 features you must cast your JDBC objects into the corresponding classes in the sybase.sql.ASA package, rather than the java.sql package. Classes that are declared as java.sql are restricted to JDBC 1.2 functionality only.
The classes in sybase.sql.ASA are as follows:
JDBC class | Sybase internal driver class |
---|---|
java.sql.Connection | sybase.sql.ASA.SAConnection |
java.sql.Statement | sybase.sql.ASA.SAStatement |
java.sql.PreparedStatement | sybase.sql.ASA.SAPreparedStatement |
java.sql.CallableStatement | sybase.sql.ASA.SACallableStatement |
java.sql.ResultSetMetaData | sybase.sql.ASA.SAResultSetMetaData |
java.sql.ResultSet | sybase.sql.SAResultSet |
java.sql.DatabaseMetaData | sybase.sql.SADatabaseMetaData |
The following function provides a ResultSetMetaData object for a prepared statement without requiring a ResultSet or executing the statement. This function is not part of the JDBC 1.2 standard.
ResultSetMetaData sybase.sql.ASA.SAPreparedStatement.describe()
The following code fetches the previous row in a result set, a feature not supported in JDBC 1.2:
import java.sql.*; import sybase.sql.asa.*; ResultSet rs; // more code here ( ( sybase.sql.asa.SAResultSet)rs ).previous();
The following classes are part of the JDBC 2.0 core interface, but are not available in the sybase.sql.ASA package:
java.sql.Blob
java.sql.Clob
java.sql.Ref
java.sql.Struct
java.sql.Array
java.sql.Map
The following JDBC 2.0 core functions are not available in the sybase.sql.ASA package:
Class in sybase.sql.ASA | Missing functions |
---|---|
SAConnection |
java.util.Map getTypeMap()
void setTypeMap( java.util.Map map ) |
SAPreparedStatement |
void setRef( int pidx, java.sql.Ref r )
void setBlob( int pidx, java.sql.Blob b ) void setClob( int pidx, java.sql.Clob c ) void setArray( int pidx, java.sql.Array a ) |
SACallableStatement |
Object getObject( pidx, java.util.Map map )
java.sql.Ref getRef( int pidx ) java.sql.Blob getBlob( int pidx ) java.sql.Clob getClob( int pidx ) java.sql.Array getArray( int pidx ) |
SAResultSet |
Object getObject( int cidx, java.util.Map map )
java.sql.Ref getRef( int cidx ) java.sql.Blob getBlob( int cidx ) java.sql.Clob getClob( int cidx ) java.sql.Array getArray( int cidx ) Object getObject( String cName, java.util.Map map ) java.sql.Ref getRef( String cName ) java.sql.Blob getBlob( String cName ) java.sql.Clob getClob( String cName ) java.sql.Array getArray( String cName ) |