Help Center/ GaussDB(DWS)/ Troubleshooting/ JDBC/ODBC/ Service Execution Exceptions
Updated on 2024-03-08 GMT+08:00

Service Execution Exceptions

Broken pipe, connection reset by peer

Possible cause: The network is faulty and the database connection times out.

Solution: Check the network status, rectify the network fault, and rectify the configuration related to database connection timeout, for example, the database parameter session_timeout.

  1. Log in to the DWS console and click the name of the target cluster.
  2. On the displayed page, click the Parameters tab and search for session_timeout to view the timeout interval.
  3. Set the values of session_timeout on CNs and DNs to 0. For details, see "Modifying Database Parameters" in the GaussDB(DWS) User Guide.

The column index is out of range

Possible cause: The result set obtained by the application is not the expected one, and the number of columns is incorrect.

Solution: Check the database table definition and SQL statements. If the result set contains only three columns, the maximum value of index is 3.

"Tried to send an out-of-range integer as a 2-byte value" Is Reported Due to Too Many Parameters in SQL Statements

Possible cause: According to the JDBC protocol, the total number of variables cannot exceed 32767, which is the maximum value of short Int.

Solution:

Data query: Split large SQL statements to ensure that the number of variables in each SQL statement is less than 32767.

Data import: Import data in batches or use copymanager .

Error "ERROR: cached plan must not change result type" Reported When the Stored Procedure Is Invoked

Possible cause: PreparedStatement is used in JDBC. By default, a plan is cached after being executed for five times. If there are table-creation operations after that (for example, the table definition modification), the error ERROR: cached plan must not change result type will be reported when the plan is executed again.

Solution: Set prepareThreshold to 0 in the JDBC connection string so that the plan is not cached. Example:

1
String url = "jdbc:postgresql:// 192.168.0.10:2000/postgres?prepareThreshold=0";

"ERROR: insufficient data left in message" Is Reported When JDBC Is Used to Execute SQL Statements

Possible cause: The server cannot process the '\0' character in the string. '\0' indicates the string whose value is 0x00 and '\u0000' in UTF encoding.

Solution: Check whether the SQL statement executed by the customer contains '\0'. If yes, replace it with a space.

"ERROR: relation xx already exists" Is Reported When the CREATE TABLE AS Statement Is Executed Using JDBC

Possible cause: When JDBC invokes preparedStatement.getParameterMetaData(), a P packet is sent. This packet creates a table in the database, which causes duplication during execution.

Solution: When using preparedStatement, you are advised to split the CREATE TABLE AS statement or use resultSet.getMetaData().