What should I do if the time for connection exceeds 20s and a server disconnection error is returned when I execute the SELECT SLEEP(21) FROM DUAL statement?
To solve this problem, specify the READTIMEOUT parameter in the odbc.ini configuration file. In this way, a socket connection is automatically closed when a read operation in the connection times out, and the client is automatically disconnected from the server to avoid long-time waiting.
# Configure the odbc.ini configuration file.
[OBDSN]
Driver = OBDRIVER
Description = OceanBase Driver DSN
SERVER = xxx.xxx.xxx.xxx (the IP address of the database)
PORT = 38884 (the port number of the database)
USER = tester@oracle (the username that you use to log on to the database)
Password = 1****** (the password that you use to log on to the database)
Database = oceanbase (the name of the database)
OPTION = 4
charset = UTF8 (the character set of the database)
READTIMEOUT= 20
If READTIMEOUT=20 and ob_query_timeout=10000000 (10s) are specified at the same time, the SELECT SLEEP(15) FROM DUAL statement returns TIMEOUT. The ob_query_timeout parameter specifies the execution timeout period on the server. When the execution on the server exceeds this timeout period, the server automatically sends an error message to the client to avoid long-time waiting of the client.