== Using connections

When you need to execute sequential queries (without a transaction), you can create a new connection
or borrow one from the pool:

[source,kotlin]
----
Code not translatable
----

Prepared queries can be created:

[source,kotlin]
----
connection.prepare("SELECT * FROM users WHERE first_name LIKE ?", { ar1 ->
  if (ar1.succeeded()) {
    var prepared = ar1.result()
    prepared.query().execute(Tuple.of("julien"), { ar2 ->
      if (ar2.succeeded()) {
        // All rows
        var rows = ar2.result()
      }
    })
  }
})

----

NOTE: prepared query caching depends on the `link:../../apidocs/io/vertx/sqlclient/SqlConnectOptions.html#setCachePreparedStatements-boolean-[setCachePreparedStatements]` and
does not depend on whether you are creating prepared queries or use `link:../../apidocs/io/vertx/sqlclient/SqlClient.html#preparedQuery-java.lang.String-[direct prepared queries]`

`link:../../apidocs/io/vertx/sqlclient/PreparedStatement.html[can perform efficient batching:

[source,kotlin]
----
{@link examples.SqlClientExamples#usingConnections03(io.vertx.sqlclient.SqlConnection)]`
----