Here you will find examples demonstrating the usage of the Vert.x SQL Client (aka Reactive SQL Client).
This example shows the basic functionality of the SQL client, it demonstrates how to connect to a database, perform basic data definition queries by creating a test table plus test data, after it shows how to perform simple queries without parameters and shows how to close the connection.
This is a follow up to the Simple
example. In this example you will see how to write queries with parameters, the
advantage of doing so is to avoid common SQL injection security issues since all parameters are used in a
PreparedStatement
before being sent to the database engine.
This is a follow up to the Simple
example.
In this example you will see how to read results as a stream instead of fetching them all in memory.
This is particularly useful when you expect large results.
The Transaction example show how to execute queries with a transaction using the asynchronous SQL client.
The Transaction rollback example is a modified version of the simple Transaction example. In this example, we manage the transaction manually and, after inserting data, we rollback the changes. The result should be an empty list.
The Template example show how to execute SQL templates.
The Template mapping example show how to execute SQL templates mapped to query params or database rows