• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Admin Alert: Turning Off ODBC Query Timeout Limits

    July 13, 2005 Joe Hertvik

    OS/400 ODBC processing is notorious for obscure error messages that offer little information about their causes or their solutions. One of the strangest is the SQL0666 error, which stops SQL query processing when the estimated query run time exceeds the system’s query processing limit. While others have documented how to avoid this error by changing an ADO property, newer iSeries Access ODBC drivers allow you to disable query timeouts directly within your Data Sources (DSN).

    For those who have not run into it, the SQL0666 error usually happens when you are using ODBC to process a large query from your PC. When it is determined that the query will process longer than OS/400’s query timeout limit, the query goes belly up and returns something similar to the following error message:

    [IBM][Client Access ODBC Driver (32-bit)][DB2/400 SQL]SQL0666
     - Estimated query processing time xxx exceeds limit yyy.
    

    Where xxx and yyy represent the estimated amount of time it will take to process the query and the OS/400 query time limit, respectively. OS/400’s query time limit is kept in the Query processing time limit system value, QQRYTIMLMT, which can be viewed or changed through the following Work with System Values command (WRKSYSVAL):

    WRKSYSVAL SYSVAL(QQRYTIMLMT)

    This system value is important for SQL processing because–when a query is submitted to OS/400–the query optimizer estimates a value for the elapsed number of seconds that the query is expected to run (as represented by xxx in the error message). This value is compared against the query time limit (as represented in QQRYTIMLMT and in the yyy value returned in the SQL0666 message). If the xxx value is greater than the yyy value, OS/400 will not allow the query to start.

    In pre-V5R2M0 versions of iSeries Access for Windows’ ODBC, query timeout value support can be disabled in applications that use ADO by setting the CommandTimeout property to 0. This technique is explained in greater detail in the articles listed in the Related Stories section.


    In more recent OS/400 versions, QQRYTIMLMT is set to *NOMAX by default, but it could have been previously set to a lower value. So if you are receiving an SQL0666 error, the first thing you will want to check is what value QQRYTIMLMT is set to and whether or not it is less than your estimated query processing time. If it is, you may be able to eliminate the SQL0666 error by increasing the QQRYTIMLMT system value. If QQRYTIMLMT is set to *NOMAX or it is larger than the estimated query processing time value and you still receive this error, you can also eliminate the error by changing an ODBC value in your DSN.

    In the ODBC driver that comes with iSeries Access for Windows V5R2 and above, IBM now provides you with a mechanism for turning off query timeout value support for applications that use a particular ODBC Data Source Name (DSN). Once your applications know that they don’t have to adhere to the query timeout value, the error disappears. You can turn off query timeout limit processing in a DSN by performing the following steps:

    • Open the ODBC Data Source Administrator on the client machine that is experiencing the SQL0666 error
    • In the Administrator window, highlight the DSN that you want to change and click on the Configure button
    • Click on the Performance tab inside the iSeries Access for Windows Setup dialogue that appears
    • Click on the Advanced button under the Performance options. This will bring up the Advanced performance options window
    • Turn off the checkmark in the Allow Query Timeout checkbox. Click on OK to exit this screen
    • Back on the iSeries Access for Windows Setup screen, click on the Apply button followed by the OK button. This allows you to exit the screen and save your changes

    Once this option is turned off, applications using this particular ODBC DSN will automatically disable support for query timeout value checking. But remember that while this option is handy for allowing longer running queries to automatically finish, it also removes a safeguard against run-away queries that will throttle PC and AS/400 performance. So use it only when it’s needed and leave it on the rest of the time.

    RELATED STORIES

    Query Time Limits and ADO: the Devil’s in the Details

    DB2-ODBC Query Timeout Property: SQL0666 Estimated Query Processing Time, Listen Software Solutions

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    What Program Uses That File? GST Says 25 Percent of iSeries Tape Restores Fail

    Leave a ReplyCancel reply

Volume 5, Number 27 -- July 13, 2005
THIS ISSUE
SPONSORED BY:

WorksRight Software
Profound Logic Software
COMMON

Table of Contents

  • CHGPF Quirk
  • What Program Uses That File?
  • Admin Alert: Turning Off ODBC Query Timeout Limits

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • PHP’s Evolution On The IBM i Platform Continues
  • Protecting IBM i Data For The AI Revolution
  • Guru: Two More Small But Handy RPG Enhancements: LIKE(*EXT) And %LOOKUPNE
  • IBM i Integration Gives Costco Shoppers Real-Time Inventory
  • IBM i PTF Guide, Volume 28, Number 33
  • IBM “Price Harmonization” Increases For Power Systems Coming In The New Year
  • Code For i Continues To Grow. Here Is What’s New
  • PowerSC: Your One-Stop Shop For Security On IBM i – And Beyond
  • As I See It: You’ve Been Flocked
  • IBM i PTF Guide, Volume 28, Number 32

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle