This topic describes how to handle PolarDB-P errors.

Connection exceptions

A connection exception refers to the error that occurs when an application or a client connects to the database. For example, after you create a connection, an error message may be returned. This indicates that the connection does not exist, the connection times out, or the client cannot connect to the database instance. Connection exceptions often occur when the network is temporarily disconnected or the database service is restarted. You must make sure that your application can reconnect to the database. This allows you to handle the exceptions for these types of connections. If you still cannot create a connection, .

Data exceptions

Data exceptions refer to the following errors, such as invalid function parameters, incorrect array index, division by zero, invalid data type, and invalid escape characters. You can find the detailed error information based on Error codes and the condition name. To handle a data exception, you need to find the exact SQL statement where the exception occurs based on the error code and message. Then, fix the SQL statement and try again.

Syntax errors

Syntax errors occur in SQL statements when you use undefined columns, functions, tables, or parameters. This also occurs when you create duplicate columns, databases, functions, tables, or aliases. The error messages can show you the exact SQL statement where the exception occurs and the error class. You can fix the issues based on the error messages.

Insufficient resources

In most cases, insufficient resources are caused by out of disk space, out of memory (OOM), too many connections, or excessive usage of specific resources. You can upgrade the instance specification to solve these issues. However, you need to address the issue based on the specific scenario. For example, if an application creates too many connections at a time, the upper limit of connections may be exceeded. Slow queries or shortage of compute resources (such as CPU and memory resources) can also result in a large number of pending connections. We recommend that you reduce the number of connections, or optimize inefficient SQL statements as needed.