1
1
<?xml version="1.0"?>
3
3
Copyright (c) 2004-2005, PostgreSQL Global Development Group
4
$PostgreSQL: pgjdbc/doc/pgjdbc.xml,v 1.25 2005/04/10 15:15:05 jurka Exp $
4
$PostgreSQL: pgjdbc/doc/pgjdbc.xml,v 1.30 2006/09/26 05:18:04 jurka Exp $
7
7
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
456
456
Act like an older version of the driver to retain compatibility with
457
older applications. At the moment this controls two driver behaviors,
458
the connection protocol and the handling of binary data fields.
457
older applications. At the moment this controls two driver behaviors:
458
the handling of binary data fields, and the handling of parameters set
459
via <function>setString()</function>
461
462
Older versions of the driver used this property to also control the
467
468
<xref linkend="binary-data" />. To force the use of
468
469
Large Objects set the compatible property to 7.1.
472
When <varname>compatible</varname> is set to <literal>7.4</literal> or
473
below, the default for the <varname>stringtype</varname> parameter is
474
changed to <literal>unspecified</literal>.
550
<term><varname>logUnclosedConnections</varname> = <type>boolean</type></term>
553
Clients may leak <classname>Connection</classname> objects by
554
failing to call its <function>close()</function> method.
555
Eventually these objects will be garbage collected and the
556
<function>finalize()</function> method will be called which will
557
close the <classname>Connection</classname> if caller has
558
neglected to do this himself. The usage of a finalizer is just
559
a stopgap solution. To help developers detect and correct the
560
source of these leaks the <literal>logUnclosedConnections</literal>
561
<acronym>URL</acronym> parameter has been added. It captures
562
a stacktrace at each <classname>Connection</classname> opening
563
and if the <function>finalize()</function> method is reached without
564
having been closed the stacktrace is printed to the log.
544
570
<term><varname>prepareThreshold</varname> = <type>int</type></term>
547
573
Determine the number of <classname>PreparedStatement</classname>
548
574
executions required before switching over to use server side prepared
549
statements. The default is zero meaning never use server side
550
prepared statements. More information on server side prepared
575
statements. The default is five, meaning start using server side
576
prepared statements on the fifth execution of the same
577
<classname>PreparedStatement</classname> object. More
578
information on server side prepared
551
579
statements is available in <xref linkend="server-prepare" />.
595
<term><varname>stringtype</varname> = <type>String</type></term>
598
Specify the type to use when binding <classname>PreparedStatement</classname> parameters
599
set via <function>setString()</function>. If <varname>stringtype</varname> is set to
600
<literal>varchar</literal> (the default), such parameters will be sent to the server as
601
<type>varchar</type> parameters. If <varname>stringtype</varname> is set to
602
<literal>unspecified</literal>, parameters will be sent to the server as untyped values,
603
and the server will attempt to infer an appropriate type. This is useful if you have an
604
existing application that uses <function>setString()</function> to set parameters that
605
are actually some other type, such as integers, and you are unable to change the
606
application to use an appropriate method such as <function>setInt()</function>.
1057
1102
<chapter id="callproc">
1058
1103
<title>Calling Stored Functions</title>
1060
<para><productname>PostgreSQL's</productname> <acronym>JDBC</acronym>
1061
driver fully supports calling <productname>PostgreSQL</productname>
1066
The <classname>CallableStatement</classname> support is only as good as
1067
the backend support for stored procedures.
1068
<productname>PostgreSQL</productname> does not support functions that
1069
have output parameters. This means you may not use
1070
<function>registerOutParameter</function> for anything other than the
1071
function's return value.
1076
1105
<example id="call-function-example">
1077
1106
<title>Calling a built in stored function</title>
1997
2026
<entry>extract(year from arg1)</entry>
1998
2027
<entry></entry>
2030
<entry>timestampadd(argIntervalType,argCount,argTimeStamp)</entry>
2032
<entry>('(interval according to argIntervalType and argCount)'+argTimeStamp)</entry>
2033
<entry>an argIntervalType value of <classname>SQL_TSI_FRAC_SECOND</classname> is not implemented since backend does not support it</entry>
2036
<entry>timestampdiff(argIntervalType,argTimeStamp1,argTimeStamp2)</entry>
2038
<entry>extract((interval according to argIntervalType) from argTimeStamp2-argTimeStamp1 )</entry>
2039
<entry>only an argIntervalType value of <classname>SQL_TSI_FRAC_SECOND</classname>,<classname>SQL_TSI_FRAC_MINUTE</classname>,<classname>SQL_TSI_FRAC_HOUR</classname> or <classname>SQL_TSI_FRAC_DAY</classname> is supported </entry>