StarQuest Technical Documents

How to Resolve StarSQL Error: "Invalid section number"

Last Update: 19 February 2019
Product: StarSQL
Version: 5.x or later
Article ID: SQV00SQ050


This document describes solutions for resolving the error "[StarSQL][StarSQL ODBC Driver][<DB2 Host>]Invalid section number".


This is typically the result of either using out-of-date StarSQL host packages or reaching the active statement handle limit. You may need to try both of the suggested solutions, depending on the nature of the failure.

Using out-of-date packages

If you have recently performed a major upgrade of StarSQL (e.g., from v. 5.3x to 5.5) and did not bind a new set of host packages, you may encounter an "Invalid section number" error during certain SQL operations. This is due to the fact that host packages created with an older version of StarSQL are not compatible with later versions of the driver.

To resolve this error, drop and bind a new set of packages using the StarAdmin tool provided with StarSQL. Refer to the StarQuest Technical Document How to Bind Packages with StarAdmin for more information about StarSQL packages and detailed instructions on how to create and bind them.

Note: StarSQL packages are always backwards compatible, which means that older StarSQL clients can use the packages created with a newer version of the driver.


StarSQL online Help
StarAdmin online Help
StarSQL User's Guide

Reaching the StarSQL statement handle limit

StarSQL restricts the number of active statement handles that can be open at any given time. The limit is 64, by default. When an application attempts to open the 65th statement handle, an "Invalid section number" error is returned.

This problem is most common with custom built applications that either have a memory/resource leak or fail to release statement handles as they are used. To avoid hitting this limit, close and release each statement object (e.g., recordset) from memory after it is used before opening another one. For example: in VB/ADO applications after closing a recordset, set the recordset object to Nothing to release it from memory and free the statement handle.

Generally, 64 statement handles are more than sufficient to perform the database tasks required by most applications. In cases where reaching this limit cannot be avoided, such as when using a third party application that requires more than 64 open statement handles, set the UseJumboPackages parameter to Yes in the StarSQL DSN to increase the limit to 1,314. After making this DSN change, bind new packages using StarAdmin with the UseJumboPackages option set to YES (see StarQuest Technical Document How to Bind Packages with StarAdmin). Refer to the StarSQL online help for more information on using jumbo packages.

Note: Any increase in the number of active statement handles increases host resource use, which may not be desirable.


StarSQL online Help


The information in technical documents comes without any warranty or applicability for a specific purpose. The author(s) or distributor(s) will not accept responsibility for any damage incurred directly or indirectly through use of the information contained in these documents. The instructions may need to be modified to be appropriate for the hardware and software that has been installed and configured within a particular organization.  The information in technical documents should be considered only as an example and may include information from various sources, including IBM, Microsoft, and other organizations.