OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Connector/ODBC

V2.0.7
  • Overview
  • Driver installation and configuration
    • Prepare for the installation
    • Install and configure OceanBase Connector/ODBC for Linux
    • Install and configure the OceanBase Connector/ODBC driver for Windows
  • User guide
    • Basic operations
    • Enable the logging feature
    • Obtain the REF CURSOR data type
  • Reference information
    • OceanBase Connector/ODBC API functions
    • OceanBase Connector/ODBC data types
    • OceanBase Connector/ODBC error codes
  • FAQ
    • Query timeout
    • Chinese garbled characters
  • Release
    • V2.0
      • OceanBase Connector/ODBC V2.0.7
      • OceanBase Connector/ODBC V2.0.6

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Connector/ODBC
  3. V2.0.7

Query timeout

Last Updated:2026-09-04 08:24:40

What should I do if the connection time exceeds 20 seconds and a server disconnection error is returned when executing the SELECT SLEEP(21) FROM DUAL statement?

What should I do if the connection time exceeds 20 seconds and a server disconnection error is returned when executing the SELECT SLEEP(21) FROM DUAL statement?

Set the READTIMEOUT parameter in the odbc.ini configuration file, which triggers the closing of the socket by a socket read timeout and allows the client to actively disconnect from the server to avoid long-time blocking of the client.

# Configure the odbc.ini configuration file
[OBDSN]
Driver     = OBDRIVER
Description = OceanBase Driver DSN
SERVER      = xxx.xxx.xxx.xxx (Database IP address)
PORT        = 38884 (Actual database port number)
USER        = tester@oracle (Username for logging in to the database)
Password    = 1****** (Password for logging in to the database)
Database    = oceanbase (Database name)
OPTION      = 4
charset  = UTF8 (Database character set)
READTIMEOUT= 20

Note that if READTIMEOUT=20 and ob_query_timeout=10000000 (10s), executing SELECT SLEEP(15) FROM DUAL will return a TIMEOUT error. This approach is achieved by setting ob_query_timeout, which causes the server to actively report an error to the client if the execution time exceeds the specified time, thereby avoiding long-time blocking of the client.

Previous topic

OceanBase Connector/ODBC error codes
Last

Next topic

Chinese garbled characters
Next
on this page
What should I do if the connection time exceeds 20 seconds and a server disconnection error is returned when executing the SELECT SLEEP(21) FROM DUAL statement?