| width='120' | '''SignaturesSignature'''|{{Func|<pre>sql:init|( $class as xs:string|) as empty-sequence()}}</pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|sql:connect|$url as xs:string|xs:anyURI}}<br/ pre>{{Func|sql:connect|( $url as xs:string, $username as xs:string?, $password as xs:string?|xs:anyURI}}<br/ >{{Func|sql:connect|$url as xs:string, $username as xs:string?, $password as xs:string?, $options as map(*)?| := map { }) as xs:anyURI}}<br/ pre>
|- valign="top"
| '''Summary'''
| '''Examples'''
|Connects to an SQL Server and sets autocommit to {{Code|true}}:
| width='120' | '''SignaturesSignature'''|{{Func|sql:execute|$id as xs:anyURI, $statement as xs:string|item()*}}<br/pre>{{Func|sql:execute|( $id as xs:anyURI, $statement as xs:string, $options as map(*)?| := map { }) as item()*}}</pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|sql:execute-prepared|$id as xs:anyURI, $params as element(sql:parameters)|item()*}}<br/pre>{{Func|sql:execute-prepared|( $id as xs:anyURI, $params as element(sql:parameters), $options as map(*)?| := map { }) as item()*}}</pre>
|- valign="top"
| '''Summary'''
| This function executes a prepared statement with the specified {{Code|$id}}. The output format is identical to {{Function||sql:execute}}. The optional parameter {{Code|$params}} is an element {{Code|<sql:parameters/>}} representing the parameters for a prepared statement along with their types and values. The following schema shall be used:<br/ >
<syntaxhighlight pre lang="'xquery"'>
element sql:parameters {
element sql:parameter {
}+
}?
</syntaxhighlightpre>
With {{Code|$options}}, the following parameter can be set:
* {{Code|timeout}}: query execution will be interrupted after the specified number of seconds.
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>sql:prepare|( $id as xs:anyURI, $statement as xs:string|) as xs:anyURI}}</pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>sql:commit|( $id as xs:anyURI|) as empty-sequence()}}</pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>sql:rollback|( $id as xs:anyURI|) as empty-sequence()}}</pre>
|- valign="top"
| '''Summary'''
{| width='100%'
|- valign="top"
| width='120' | '''SignaturesSignature'''|{{Func|<pre>sql:close|( $id as xs:anyURI|) as empty-sequence()}}</pre>
|- valign="top"
| '''Summary'''
A simple select statement can be executed as follows:
<syntaxhighlight pre lang="'xquery"'>
let $id := sql:connect("jdbc:postgresql://localhost:5432/coffeehouse")
return sql:execute($id, "SELECT * FROM coffees WHERE price < 10")