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

Chapter 8 Issuing
Remote Procedure Calls [Table of Contents] Chapter 10 Using Bulk Copy Transfer

Access Service User's Guide DirectConnect for AS/400

[-] Chapter 9 Understanding the Transfer process

Chapter 9

Understanding the Transfer process

This chapter describes several concepts of the transfer process, covered in the following sections:

All references to Adaptive Server 12.0 apply to SQL Server 11.1 and later, unless otherwise indicated.

General description of the Transfer process

The transfer process allows you to transfer rows and columns of data between tables in multiple databases from a client application. Based on your needs and limitations, you can select from one of two transfer options: bulk copy and destination-template.

Bulk copy and Destination-Template transfer

Bulk copy transfer and destination-template transfer processes differ as follows:

The following table further describes the conditions that determine the type of transfer you select.

Comparison of two transfer command types

Use bulk copy transfer to...

Use destination-template transfer to...

Execute the transfer quickly

Exercise more control over the transfer

Perform implicit datatype conversions

Move tables of data in which you need to explicitly specify datatype conversion, such as when the data is structurally incompatible

Move entire tables of data in which column types are compatible between the source and destination databases:

raster

transfer to secondary_connection; with replace into target_table; select col1, col 2 from source_table

Perform arbitrary actions against a target database using input from the source database, such as moving tables when the source table has more columns than the target:

raster

transfer to secondary_connection; select col2, col3 from source_table; insert into target_table values (?,?)

In both types of transfer, the transfer statement must be the only statement in a request.

For detailed information about bulk copy transfer, see Chapter 10, "Using Bulk Copy Transfer"

For detailed information about destination-template transfer, see Chapter 11, "Using Destination-Template Transfer"

Description of terms in the Transfer process

Following are terms used in the transfer process discussion.

Primary database

This refers to the DBMS that is always implied in the transfer statement. For DirectConnect for AS/400 access services, this is an AS/400 database.

Secondary database

This database is another DBMS that is defined in the connection string within the transfer statement. The secondary database can be a database that is targeted by another access service or it can be an ASE. Always specify the secondary database in transfer statements.

Source database

The source is defined as the database the data is coming from.

Destination database

This database is where the data is being sent, also called the target. Either the primary or secondary database can be the source or destination, depending on whether you use the transfer from or transfer to command.

The following figure shows the access service configured to access a particular AS/400 database, which is the primary database. The secondary database is an Adaptive Server database located on the LAN. The client application can transfer data from the AS/400 to Adaptive Server, or from Adaptive Server to the AS/400.

Figure 9-1: Access service data transfer between databasesraster

During a transfer:

Transfer direction

You can transfer data in either of two directions:

For example, when you execute a bulk copy transfer from statement, the secondary database (either Adaptive Server or another database) is the source of the data to be transferred. The primary database, AS/400, becomes the destination database, or target.

For implications of using one transfer direction over another, see "Datatype conversion for Transfer processing" .

Unit of Work

A unit of work is one or more requests that execute, commit, or roll back as a group. Following are descriptions of a unit of work for bulk copy and destination-template transfer.

Bulk Copy transfer

Unit of work is based on the setting of the BulkCommitCount property.

Destination-Template transfer

When a destination-template transfer statement moves data from Adaptive Server to the AS/400, the access service automatically sets the StopCondition property to none. Subsequent commit and rollback processing is determined by whether short or long transactions are in effect:

The value set in the TransferBatch configuration property determines the size of the batch.

Transfer targets

The transfer statement allows you to move data in either direction between the AS/400 and:

Datatype conversion for Transfer processing

The two transfer types handle datatype conversion differently. After converting the incoming source database datatypes into appropriate Open Client/Server datatypes, the access service does one of the following:

When conversion fails, several configuration properties control how the error is handled. These properties are discussed on .

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

When you transfer data between two access services (such as DB2 to AS/400, AS/400 to DB2), we recommend that you execute the transfer from command from the AS/400 to guarantee native datatype mapping. Also, the transfer from command is the only way you can transfer text and image columns between access services.

Transfer errors and error handling

Transfer processing errors can occur due to:

Each of these transfer error types is explained in the following sections.

Structural errors

A structural error can be one of two types:

Each type is described in the following sections.

Incompatible datatypes

Datatypes are incompatible when source and target table datatypes cannot be mapped to one another. For example, binary to datetime transfers are not allowed.

For both transfer types, if any columns have incompatible datatypes, the access service cancels the transfer, without attempting to transfer any rows.

Incompatible number of columns

When the access service detects an unequal number of columns between the source and the target, a structural error may occur.

Value errors

Value errors occur during transfer processing when the value being inserted has one of the following characteristics:

The access service handles these errors using the following properties:

If the SendWarningMessages property is set to yes, the access service sends a message to the client application when it encounters value errors.

In addition, as mentioned in "Datatype conversion for Transfer processing" , the preceding properties can be used to fill in default values when datatype conversion fails during both types of transfer.

For more information about the configuration properties mentioned here, see Chapter 2, "Configuring the DirectConnect Access Service Library"

For information about values that cause errors for the AS/400 access service during bulk copy transfer, see "Errors from data values" .

Error reporting for Transfer processing

You can use one of three methods to obtain error information about transfer processing:

Controlling processing with TransferErrorCount property

During transfer processing, the access service automatically sets the StopCondition property to none. Then, it uses the value set in the TransferErrorCount property to determine how many error rows are allowed before processing stops. You can set this value with the following statement:

set TransferErrorCount nnn

The default setting is 0 (zero), which causes the access service to ignore errors.

Backward compatibility

We recommend that you use the transfer from command from the AS/400 when you transfer data between:

Using transfer from guarantees native datatype mapping.


Chapter 8 Issuing
Remote Procedure Calls [Table of Contents] Chapter 10 Using Bulk Copy Transfer