Newsletters   Subscriptions  Forums  Store   Career  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 5, Number 27 -- July 13, 2005

Admin Alert: Turning Off ODBC Query Timeout Limits


by 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

Sponsored By
COMMON

COMMON Fall 2005
IT Education Conference & Expo
Orlando, Florida
September 18-22, 2005

Register Now!

COMMON is the world's largest community of IBM midrange users providing information, education and networking for end-users. COMMON is hosting its Fall 2005 IT Education Conference & Expo in Orlando, Florida, September 18-22, and will feature a host of sessions and hands-on labs covering business strategy, networking, and development, with a featured educational focus on Virtualization. Take advantage of the real-world technical education, best-practice sharing with fellow iSeries users, and access to IBM executives and developers that you can't find anywhere else!

    Conference Highlights
  • Choose from hundreds of sessions organized by specific Courses of Study to help
          you find the technical information you need.
  • Take part in one of four in-depth pre-conference workshops covering HMC,
          Virtualization, SQL, and RPG.
  • Explore the latest technology solutions in the industry's largest iSeries-related Expo.
  • Network with like-minded peers at COMMON social events.
  • Speak directly with IBM executives at the iSeries Town Hall Meeting and take
          advantage of multiple opportunities to talk with the IBM experts who build the
          technology that you use every day.

COMMON education is one of the most cost-effective ways to gain the tools and knowledge you need to meet the changing demands of information technology. You'll receive education unlike any offered within the industry that will enable you to garner a tangible and immediate return on your investment. In fact, more than 95% of COMMON Spring 2005 attendees said they gained information from sessions that was of immediate value when they returned to work.

In addition to the direct savings on education, conference attendees make lasting career connections with other iSeries professionals whom they can consult long after the conference ends. Attendees will also have direct access to IBM developers and managers. The Expo offers an opportunity to talk one-on-one with industry vendors who provide the latest products and services. This means attendees return to the office with real-time solutions that can be implemented immediately--without wasting countless hours in independent research.

For more information on COMMON and to register, please visit:
www.common.org


Technical Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.


THIS ISSUE
SPONSORED BY:

WorksRight Software
Profound Logic Software
COMMON


Four Hundred Guru

BACK ISSUES

TABLE OF
CONTENTS
CHGPF Quirk

What Program Uses That File?

Admin Alert: Turning Off ODBC Query Timeout Limits


The Four Hundred
Server Ecosystems: Take a Ride on a Slide

Java Turns Ten, Still At Odds with .NET, Aloof About PHP

iSeries ISVs Make Big Investments in Regulatory Compliance

As I See It: Declining Fortunes

Four Hundred Stuff
IBM Tweaks the iSeries Line with Improvements

Identity Management Comes to Forefront as Data Losses Mount

Seagull Heightens Human Interaction with LegaSuite BPM

System Objects Updates Delphi/400 Development Tools

Four Hundred Monitor


Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc. (formerly Midrange Server), 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement