This topic describes how to enable PrepareStatement for a client in different programming languages.

In most databases, SQL statements can be preprocessed on the server to improve database performance. AnalyticDB for MySQL databases have the strong query capability, computing power, and plan cache feature. These databases deliver high performance regardless of whether the SQL statements are preprocessed.

AnalyticDB for MySQL databases do not support the protocol for preprocessing SQL statements on the server. In most programming languages, you can enable PrepareStatement for a client to prepare statements or interpolate parameters on the client.

MySQL Connector/J (JDBC) driver

You can enable PrepareStatement for the MySQL Connector/J (JDBC) driver when the following condition is met: useServerPrepStmts=false. For more information, visit Configuration Properties for Connector/J.

Note If the useCursorFetch=true condition is met, the useServerPrepStmts=false condition is overwritten and PrepareStatement cannot be enabled.

MariaDB Connector/J

You can enable PrepareStatement for MariaDB Connector/J if the following condition is met: useServerPrepStmts=false. For more information, visit About MariaDB Connector/J.

Go MySQL driver

You can enable PrepareStatement for the Go MySQL driver if the following condition is met: interpolateParams=true. For more information, visit go-sql-driver.

PDO

You can enable PrepareStatement for PDO if the following condition is met: PDO::ATTR_EMULATE_PREPARES=TRUE. For more information, visit PDO::setAttribute.