Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 4 Converting Datatypes [Table of Contents] Chapter 6 Issuing SQL statements

Access Service User's Guide DirectConnect

[-] Chapter 5 Understanding the Request process

Chapter 5

Understanding the Request process

This chapter presents an overview of the request process, including Application Program Interface (API) procedure calls and how they interact with the access service on a command-based level.

This chapter presents the following topics:

Request types

The access service processes the following types of requests:

Request processing flow

Request processing follows these steps:

The following figure shows the processing flow of the APIs through DirectConnect to DB2.

Figure 5-1: Processing flow through API to DB2raster

For more information about Open Client/Server products, see the Sybase Client Client-Library/C Reference Manual and the Sybase Server Server-Library/C Reference Manual.

API Calls

This section describes how the following client API procedure calls interact with the access service on a command-based level:

DB-Library client API processing

The following figure shows the interaction between a DB-Library client application and the access service.

Figure 5-2: DB-Library client API exampleraster

The DB-Library API processing flow includes the following steps:

Procedure calls for the DB-Library API are explained in the Microsoft SQL Server Programmers Reference and the Sybase Open Client DB-Library/C Reference Manual.

For information about accessing database catalog information with applications that use CSPs, see Chapter 12, "Accessing catalog information with CSPs"

ODBC Client API processing

Sybase provides an ODBC Driver that allows ODBC applications to access DB2 through DirectConnect.

The following figure shows the interaction between an ODBC client application and DirectConnect.

Figure 5-3: ODBC client API exampleraster

The ODBC API processing flow includes the following steps:

Procedure calls for the ODBC API are described in the Microsoft ODBC Programmer's Reference and SDK Guide.

CT-Library client API processing

The following figure shows the interaction between a Sybase Open Client CT-Library API and DirectConnect.

Figure 5-4: CT-Library client API exampleraster

The CT-Library client API processing flow includes the following steps:

Procedure calls for the CT-Library API are described in the Sybase Open Client Client-Library/C Reference Manual.

Managing transactions

To fully understand how properties in the access service interact to control the processing flow, you should first understand the following concepts:

These concepts are discussed in the following section.

Request

A request is one or more database operations sent by the client application as one unit to the database. (For the access service, a database operation is usually a SQL statement.) During a request, the client application gives up control to the DBMS and waits for a response.

Unit of Work

A unit of work is one or more requests that are committed or rolled back as a group.

If all the requests process successfully, the unit of work is committed, and the requested changes to the database are permanent. Depending on the setting of the TransactionMode property, either the client application or the access service issues the commit statement.

For more information about the StopCondition property, which controls the conditions under which the access service stops processing, see page and page .

Transactions

For the access service, a transaction is equivalent to a unit of work (one or more requests). A transaction can span many requests.

Depending on access service property settings, the TransactionMode property that governs transaction behavior can be set to either short or long.

Short transactions

When short transactions are in effect, the access service is responsible for controlling the commitment of requests. After sending the request to the database, the access service automatically issues one of the following:

A begin transaction phrase can affect the behavior of a short transaction. If it receives a begin transaction phrase, the access service:

Long transactions

When long transactions are in effect, the client application is responsible for controlling when the transaction ends (by issuing either a commit or a rollback).

If the access service encounters a begin transaction phrase in a request, the phrase is ignored because the phrase does not affect the unit of work management.

The client application issues a commit or rollback statement for each transaction. When the client application closes its connection, the access service issues a rollback before exiting. Therefore, the client must commit any work that should be committed.

If the client application does not issue timely commits or rollbacks, then host resources, such as the APPC session or DB2 logging and locking, are held for an indeterminate amount of time. Therefore, longtransactions can cause performance problems for other applications that need to access the same resource.

See the Managing processing section that follows for more information about the Allocate and StopCondition properties, and how they interact with the transaction mode.

Managing processing

You can control processing by using configuration properties to determine the following:

For more information about the preceding properties, see Chapter 2, "Configuring the DirectConnect Access Service Library" .

To set values for properties in the configuration file, you must know the specific category the property belongs to, verify that the category exists in the file, and enter the property value under the category.

MaxRowsReturned property

The MaxRowsReturned property specifies the maximum number of rows retrieved in a result set. (A result set is all or part of the results from a processed SQL statement.) However, one SQL request can produce multiple result sets.

If the number of rows exceeds the value of the MaxRowsReturned property, the access service returns the maximum number of rows and issues a warning message. However, the access service issues warning messages only when the SendWarningMessages property is enabled.

StopCondition property

The StopCondition property specifies whether the access service stops processing a request when it encounters an error or a warning. Valid values are:

If you specify none, processing continues even when errors occur. The StopCondition property is useful if you batch multiple statements in a request.

Allocate property

The Allocate property specifies when the APPC conversation that exists between the access service and the target database system is allocated and deallocated. Valid values are connect and request.

Effects of combined property settings on transaction behavior

The tables on the following pages show how combined configuration property settings can affect processing results. The first two tables are based on the TransactionMode property settings of short and long. The third table shows processing behavior when a begin transaction statement occurs.

The following four tables show the effects of combined StopCondition and Allocate properties, based on a TransactionMode setting of short.

The following table shows the effects of a TransactionMode property setting of short, an Allocate property of request and a StopCondition property of error.

TransactionMode = short, Allocate = request, StopCondition = error

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

The transaction rolls back immediately.

What is the status of the connection after an error occurs?

The connection ends.

What happens if a begin transaction occurs?

A commit occurs and uses begin transaction behavior described in Table 5-9.

When the client application issues a commit or rollback, what happens?

A commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

The request behaves the same as TransactionMode=long.

In batch mode, what happens if an error occurs?

The batch ends and a rollback occurs.

When completed, is a batch job committed?

The batch commits if no errors occur.

After the batch commits, what is the status of the connection?

The connection ends.

The following table shows the effects of a TransactionMode property setting of short, an Allocate property of request and a StopCondition property of none.

TransactionMode = short, Allocate = request, StopCondition = none

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

A commit occurs and uses begin transaction behavior described in Table 5-9.

When the client application issues a commit or rollback, what happens?

A commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

The request behaves the same as TransactionMode=long.

In batch mode, what happens if an error occurs?

The batch continues executing.

When completed, is a batch job committed?

The batch is always committed.

After the batch commits, what is the status of the connection?

The connection ends.

The following table shows the effects of a TransactionMode property setting of short, an Allocate property of connect and a StopCondition property of error.

TransactionMode = short, Allocate = connect, StopCondition = error

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

The transaction rolls back immediately.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

A commit occurs and uses begin transaction behavior described in Table 5-9.

When the client application issues a commit or rollback, what happens?

A commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

The request behaves the same as TransactionMode=long.

While in batch, what happens if an error occurs?

The batch request ends.

When completed, is a batch job committed?

The batch commits if no errors occur.

After the batch commits, what is the status of the connection?

The connection continues.

The following table shows the effects of a TransactionMode property setting of short, an Allocate property of connect and a StopCondition of none.

TransactionMode = short, Allocate = connect, StopCondition = none

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

A commit occurs and uses begin transaction behavior described in Table 5-9.

When the client application issues a commit or rollback, what happens?

A commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

The request behaves the same as TransactionMode=long.

In batch mode, what happens if an error occurs?

The batch continues.

When completed, is a batch job committed?

The batch commit occurs, if no errors occur.

After the batch commits, what is the status of the connection?

The connection continues.

The following four tables show the effects of StopCondition and Allocate properties, based on a TransactionMode setting of long.

The following table shows the effects of a TransactionMode property setting of long, an Allocate property of request and a StopCondition of error.

TransactionMode = long, Allocate = request, StopCondition = error

Condition/Status

Effect of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

The begin transaction is ignored.

When the client application issues a commit or rollback, what happens?

If TransactionMode was originally short, and cursors and dynamics were all freed, the commit or rollback occurs and TransactionMode changes back to short. If TransactionMode was originally long, then a commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

If TransactionMode was originally short, and cursors and dynamics were all freed, a commit occurs and TransactionMode changes back to short. If TransactionMode was originally long, then the connection behaves the same as Allocate=request until all cursors and dynamics are freed.

In batch mode, what happens if an error occurs?

The batch transaction ends.

When completed, is a batch job committed?

The batch does not commit.

After the batch commits, what is the status of the connection?

The connection ends if the commit or rollback occurs at the end of batch. Otherwise, the connection continues.

The following table shows the effects of a TransactionMode property setting of long, an Allocate property of request and a StopCondition of none.

TransactionMode = long, Allocate = request, StopCondition = none

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

The access service ignores the begin transaction command.

When the client application issues a commit or rollback, what happens?

If TransactionMode was originally short, and cursors and dynamics were all freed, the commit or rollback occurs and TransactionMode changes back to short. If TransactionMode was originally long, then a commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

If TransactionMode was originally short, and cursors and dynamics were all freed, a commit occurs and TransactionMode changes back to short. If TransactionMode was originally long, then the connection behaves the same as Allocate=request until all cursors and dynamics are freed.

While in batch, what happens if an error occurs?

The batch continues.

When completed, is a batch job committed?

The batch does not commit.

After the batch commits, what is the status of the connection?

The connection ends if the commit or rollback occurs at the end of the batch. Otherwise, the connection continues.

The following table shows the effects of a TransactionMode property setting of long, an Allocate property of connect and a StopCondition of error.

TransactionMode = long, Allocate = connect, StopCondition = error

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

The access service ignores the begin transaction command.

When the client application issues a commit or rollback, what happens?

If TransactionMode was originally short, and cursors and dynamics were all freed, the commit or rollback occurs and TransactionMode changes back to short. If TransactionMode was originally long, then a commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

If TransactionMode was originally short, and cursors and dynamics were all freed, the commit occurs and TransactionMode changes back to short. If TransactionMode was originally long, then the connection behaves the same as Allocate=request until all cursors and dynamics are freed.

While in batch, what happens if an error occurs?

The batch request ends.

When completed, is a batch job committed?

The batch does not commit.

After the batch commits, what is the status of the connection?

The connection continues.

The following table shows the effects of a TransactionMode property setting of long, an Allocate property of connect and a StopCondition of none.

TransactionMode = long, Allocate = connect, StopCondition = none

Condition/Status

Effects of Settings on Processing

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if a begin transaction occurs?

The access service ignores the begin transaction command.

When the client application issues a commit or rollback, what happens?

If TransactionMode was originally short, and cursors and dynamics were all freed, the commit or rollback occurs and TransactionMode changes back to short. If TransactionMode was originally long, then a commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

If TransactionMode was originally short, and cursors and dynamics were all freed, a commit occurs and TransactionMode changes back to short. If TransactionMode was originally long, then the connection behaves the same as Allocate=request until all cursors and dynamics are freed.

In batch mode, what happens if an error occurs?

The batch continues.

When completed, is a batch job committed?

The batch does not commit.

After the batch commits, what is the status of the connection?

The connection continues.

The following table shows the effect on processing when a begin transaction command occurs in a request.

Effects of begin transaction command on processing

Condition/Status

When begin transaction occurs...

Does a rollback occur on an error?

A rollback does not occur.

What is the status of the connection after an error occurs?

The connection continues.

What happens if another begin transaction occurs?

The access service ignores the begin transaction command.

When the client application issues a commit or rollback, what happens?

If TransactionMode was originally short, it changes back to short. If TransactionMode was originally long, then a commit or rollback occurs.

If the request is a cursor or dynamic request, how does it behave?

The request continues behaving as a short setting.

In batch mode, what happens if an error occurs?

The batch continues.

When completed, is a batch job committed?

The batch does not commit.

After the batch commits, what is the status of the connection?

The connection continues.

Troubleshooting

You can troubleshoot processing problems by using server log and trace files.

Configuration properties control whether data is recorded in the server log file and server trace file for each logging and tracing option. To configure log and trace properties, edit the access service library configuration file.

For detailed information about access service library and access service logging and tracing properties, see Chapter 2, "Configuring the DirectConnect Access Service Library" in this manual.

For information about server logging and tracing properties and detailed information about the server log file and server trace file, see the DirectConnect Server Administration Guide.

Logging options

Log properties allow you to record information for access service administration. Logging options are controlled by the server, access service library, and access service configuration properties. Each logging option requires the configuration property name and value.

Tracing options

Trace properties allow you to record troubleshooting information for Sybase Technical Support.

Warning!

To provide Sybase Technical Support with all necessary data, the server trace file will be allocated a maximum of 20 MB of space. When the server trace file exceeds the maximum it will be copied to a file with the same filename and with an "_old" extension (<filename>_old). See the DirectConnect Server Administration Guide for suggestions for deleting or backing up old log and trace files.

For information about configuration property syntax, see "Access Service Tracing properties" .

Calling Sybase Technical Support

See "Sybase Technical Support" for detailed information.


Chapter 4 Converting Datatypes [Table of Contents] Chapter 6 Issuing SQL statements