ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Native Connectors/Native Accesses / Native DB2 Connector
  • Overview
  • Main remarks
  • Required versions
  • Unicode items
  • Lock timeout
  • Default values of items
  • Specific features of Native DB2 Connector
  • Analysis options
  • User types
  • INSERT queries and automatic identifier
  • Identical records
  • Independent contexts
  • SQL locks
  • HFSQL lock
  • Duplicate error on the Automatic Identifier item
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Native DB2 Connector: Specific features and remarks
Native Connectors (Native Accesses)Available only with this kind of connection
Overview
The following paragraphs present the main aspects and specific features of the Native DB2 Connector.
Main remarks

Required versions

Caution: This version of the Native DB2 Connector works with WINDEV and WEBDEV 2024.

Unicode items

The Native DB2 Connector does not support Unicode items. We advise you to use text items in Ansi format and to perform the conversion (if necessary) with UnicodeToAnsi.
HCreation will display an error message when creating files containing items in Unicode format.

Lock timeout

The lock timeouts on a DB2 database are not limited by default. The application can be locked if the two following conditions occur at the same time:
  • record locked by SQLLock,
  • this record is already locked.
We strongly advise you to define a lock timeout for each DB2 database used with the Native DB2 Connector. The lock timeout is usually set to 30 seconds.
See the documentation specific to DB2 for more details.

Default values of items

The default values of items are managed by Native DB2 Connector. The default values can be:
  • a value,
  • an SQL formula. In this case, the SQL expression must be recognized by the HFSQL engine and by the DB2 database. The only expression that can be used is CURRENT_TIMESTAMP.
Specific features of Native DB2 Connector

Analysis options

  • The analysis options regarding the full-text indexes are not supported by the Native Connector.
  • The analysis options regarding the partial indexing of text memos are not supported by the Native Connector.

User types

The Native DB2 Connector does not support the user types defined in DB2.

INSERT queries and automatic identifier

The automatic identifiers are not supported by the INSERT queries (created through programming or in the query editor). To use an automatic identifier, call HAdd on the table.

Identical records

The Native DB2 Connector cannot differentiate between two identical records (which means records with identical values for all items, excluding memo items).
When a record is modified or deleted, all the identical records will be modified or deleted.

Independent contexts

The Native DB2 Connector does not support the independent contexts. All the operations are performed in the same HFSQL context, even if an independent context was requested for a window, a page or a report.

SQL locks

In a browse performed by SQLFetch and SQLGetCol, the record currently read is locked in write mode.
When using SQLLock, the Native Connector browses the data on a "repeatable read" isolation level (for more details, see the documentation about DB2).
Therefore, several users can simultaneously lock a record in write mode (SQLLock returns True for both users). However, only the user who locked the record first will be able to modify it or to delete it. The other users will be able to access the record in read-only.

HFSQL lock

The locks CANNOT be used with the HFSQL functions in this version.

Duplicate error on the Automatic Identifier item

The "Automatic identifier" column of a table created by HCreation is as follows:
BIGINT NOT NULL GENERATED BY DEFAULT
AS IDENTITY (START WITH 1, INCREMENT BY 1), PRIMARY KEY
The value of the automatic identifier is automatically managed by DB2.
To do so, a counter is incremented whenever an addition is performed.
However, DB2 does not increment the counter if you force the value of the automatic identifier in an INSERT query.
When another addition is performed, a duplicate error may occur if DB2 automatically generates a value that already exists for the automatic identifier.
To avoid this problem, run the following query to reinitialize the value of the counter to a value greater than the specified identifier:
ALTER TABLE <Table name> ALTER COLUMN <Name of auto ID>
RESTART WITH <Max value of auto ID in file +1>
Remark: The Native DB2 Connector automatically performs this operation after the call to HAdd(hSetIDAuto).
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/11/2023

Send a report | Local help