Changes

Jump to navigation Jump to search
105 bytes removed ,  16:30, 24 June 2015
|-
| width='120' | '''Signatures'''
|{{Func|sql:connect|$url as xs:string|xs:integer}}<br/ >{{Func|sql:connect|$url as xs:string, $user as xs:string, $password as xs:string|xs:integer}}<br/ >{{Func|sql:connect|$url as xs:string, $user as xs:string, $password as xs:string, $options as map(xs:string, item())|xs:integer}}<br/ >
|-
| '''Summary'''
|This function establishes a connection to a relational database. As a result a connection handle is returned. The parameter {{Code|$url}} is the URL of the database and shall be of the form: {{Code|jdbc:<driver name>:[//<server>[/<database>]]}}. If the parameters {{Code|$user}} and {{Code|$password}} are specified, they are used as credentials for connecting to the database. The {{Code|$options}} parameter can be used to set connection options, which can either be specified<br/>* as children of an {{Code|&lt;sql:options/&gt;}} element, e.g.:<pre class="brush:xml"><sql:options> <sql:autocommit value='true'/> ...</sql:options></pre>* as map, which contains all key/value pairs:<pre class="brush:xml">map { "autocommit": true(), ... }</pre>
|-
| '''Errors'''
|{{Error|BXSQ0001|XQuery Errors#SQL Functions Errors}} an SQL exception occurs, e.g. missing JDBC driver or not existing relation.
|-
| '''Examples'''
|Connects to an SQL Server and sets autocommit to {{Code|true}}:
<pre class="brush:xquery">
sql:connect('dbc:sqlserver://DBServer', map { 'autocommit': true() })
</pre>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu