8000 FAQ · jasync-sql/jasync-sql Wiki · GitHub
[go: up one dir, main page]

Skip to content
Ohad Shai edited this page Oct 9, 2022 · 11 revisions

Q: I inserted a row, how do I get an auto-incremented id?

A: In MySQL MySQLQueryResult has a field lastInsertId. There are other solutions as well as described here: http://www.mysqltutorial.org/mysql-last_insert_id.aspx.
In PosgreSQL use Insert with Returning.

Q: Are transactions supported?

A: Yes, see Connection.inTransaction().

Q: Is SSL supported?

A: It is supported for PostgreSQL. Use SSLConfiguration to configure SSL.

Q: Are spatial types supported?

A: No, but it is possible to work around that on a query use astext(). See more details here: https://github.com/jasync-sql/jasync-sql/issues/30.

The full list of supported types available here:

Q: I am getting the following error: prepared statement "X" does not exist. What can cause this?

A: Prepared Statements are compiled once and stored per connection both on the DB and on a cache in the client. This error means that the statement is missing in the DB (by ID). It can be caused by various reasons. For example, a proxy such as pgbouncer in transaction mode is dropping the connection in the proxy without notifying the client. To overcome that either set sendPreparedStatement(..., release=true) or change how the proxy is configured.

Q: How can I see the message begin sent and received between the driver and the server?

A: turn on trace logging for com.github.jasync.sql.db. To debug pool related issue define 'com.github.jasync.sql.db.pool' instead.

Q: How can I obtain the specific error code received from the db?

A: Cast the exception to MySQLException or postgres GenericDatabaseException similar to how it was done here.
There are also other types of exceptions that can be thrown.
The full list is: common, mysql, postgres.

Q: Is R2DBC version < 1 supported?

A: The removal of getColumnNames method was backward incompatible with r2dbc-spi 0.9.1.
Therefore, jaync-sql 2.0.8 will be the last version that's compatible with r2dbc <= 0.9.1.

Clone this wiki locally
0