<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Documentation on pgJDBC</title>
		<link>https://jdbc.postgresql.org/documentation/</link>
		<description>Recent content in Documentation on pgJDBC</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Sun, 19 Jun 2022 22:46:55 +0530</lastBuildDate>
		
			<atom:link href="https://jdbc.postgresql.org/documentation/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Setting up the JDBC Driver</title>
				<link>https://jdbc.postgresql.org/documentation/setup/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/setup/</guid>
				<description>&lt;p&gt;This section describes the steps you need to take before you can write or run programs that use the JDBC interface.&lt;/p&gt;&#xA;&lt;h2 id=&#34;getting-the-driver&#34; class=&#34;self-link&#34;&gt;Getting the Driver &lt;a class=&#34;header-link&#34; href=&#34;#getting-the-driver&#34;&gt;&#xA;        &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;24&#34; height=&#34;24&#34;&#xA;            style=&#34;fill: #0093AF;&#34;&gt;&#xA;            &lt;path&#xA;                d=&#34;M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;            &lt;path&#xA;                d=&#34;m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Precompiled versions of the driver can be downloaded from the &lt;a href=&#34;https://jdbc.postgresql.org&#34;&gt;PostgreSQL® JDBC web site&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Initializing the Driver</title>
				<link>https://jdbc.postgresql.org/documentation/use/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/use/</guid>
				<description>&lt;p&gt;This section describes how to load and initialize the JDBC driver in your programs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;importing-jdbc&#34; class=&#34;self-link&#34;&gt;Importing JDBC &lt;a class=&#34;header-link&#34; href=&#34;#importing-jdbc&#34;&gt;&#xA;        &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;24&#34; height=&#34;24&#34;&#xA;            style=&#34;fill: #0093AF;&#34;&gt;&#xA;            &lt;path&#xA;                d=&#34;M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;            &lt;path&#xA;                d=&#34;m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;Any source file that uses JDBC needs to import the &lt;code&gt;java.sql&lt;/code&gt; package, using:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Using SSL</title>
				<link>https://jdbc.postgresql.org/documentation/ssl/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/ssl/</guid>
				<description>&lt;p&gt;Configuring the PostgreSQL® server for SSL is covered in the &lt;a href=&#34;https://www.postgresql.org/docs/current/ssl-tcp.html&#34;&gt;main documentation&lt;/a&gt;, so it will not be repeated here. There are also instructions in the source &lt;a href=&#34;https://github.com/pgjdbc/pgjdbc/tree/master/certdir&#34;&gt;certdir&lt;/a&gt;&#xA;Before trying to access your SSL enabled server from Java, make sure&#xA;you can get to it via &lt;strong&gt;psql&lt;/strong&gt;. You should see output like the following&#xA;if you have established a SSL  connection.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ ./bin/psql -h localhost -U postgres&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;psql &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;14.5&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;SSL connection &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Type &lt;span class=&#34;s2&#34;&gt;&amp;#34;help&amp;#34;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; help.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nv&#34;&gt;postgres&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;c1&#34;&gt;#&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;custom-sslsocketfactory&#34; class=&#34;self-link&#34;&gt;Custom SSLSocketFactory &lt;a class=&#34;header-link&#34; href=&#34;#custom-sslsocketfactory&#34;&gt;&#xA;        &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;24&#34; height=&#34;24&#34;&#xA;            style=&#34;fill: #0093AF;&#34;&gt;&#xA;            &lt;path&#xA;                d=&#34;M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;            &lt;path&#xA;                d=&#34;m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;PostgreSQL® provides a way for developers to customize how an SSL connection is established. This may be used to provide&#xA;a custom certificate source or other extensions by allowing the developer to create their own &lt;code&gt;SSLContext&lt;/code&gt; instance.&#xA;The connection URL parameters &lt;code&gt;sslfactory&lt;/code&gt; allow the user to specify which custom class to use for creating the&#xA;&lt;code&gt;SSLSocketFactory&lt;/code&gt; . The class name specified by &lt;code&gt;sslfactory&lt;/code&gt; must extend &lt;code&gt;javax.net.ssl.SSLSocketFactory&lt;/code&gt; and be&#xA;available to the driver&amp;rsquo;s classloader.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Issuing a Query and Processing the Result</title>
				<link>https://jdbc.postgresql.org/documentation/query/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/query/</guid>
				<description>&lt;p&gt;Any time you want to issue SQL statements to the database, you require a &lt;code&gt;Statement&lt;/code&gt; or &lt;code&gt;PreparedStatement&lt;/code&gt; instance. Once you have a &lt;code&gt;Statement&lt;/code&gt; or &lt;code&gt;PreparedStatement&lt;/code&gt; , you can use issue a query. This will return a &lt;code&gt;ResultSet&lt;/code&gt; instance, which contains the entire result (see the section called &lt;a href=&#34;https://jdbc.postgresql.org/documentation/query/#getting-results-based-on-a-cursor&#34;&gt;Getting results based on a cursor&lt;/a&gt; here for how to alter this behaviour). &lt;a href=&#34;https://jdbc.postgresql.org/documentation/query/#example51processing-a-simple-query-in-jdbc&#34;&gt;Example 5.1, “Processing a Simple Query in JDBC”&lt;/a&gt; illustrates this process.&lt;/p&gt;&#xA;&lt;h5 id=&#34;example51processing-a-simple-query-in-jdbc&#34; class=&#34;self-link&#34;&gt;Example 5.1. Processing a Simple Query in JDBC &lt;a class=&#34;header-link&#34; href=&#34;#example51processing-a-simple-query-in-jdbc&#34;&gt;&#xA;        &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;24&#34; height=&#34;24&#34;&#xA;            style=&#34;fill: #0093AF;&#34;&gt;&#xA;            &lt;path&#xA;                d=&#34;M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;            &lt;path&#xA;                d=&#34;m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/a&gt;&lt;/h5&gt;&#xA;&lt;p&gt;This example will issue a simple query and print out the first column of each row using a &lt;code&gt;Statement&lt;/code&gt; .&lt;/p&gt;</description>
			</item>
			<item>
				<title>Calling Stored Functions and Procedures</title>
				<link>https://jdbc.postgresql.org/documentation/callproc/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/callproc/</guid>
				<description>&lt;p&gt;PostgreSQL® supports two types of stored objects, functions that can return a result value and - starting from v11 - procedures&#xA;that can perform transaction control. Both types of stored objects are invoked using &lt;code&gt;CallableStatement&lt;/code&gt; and the standard&#xA;JDBC escape call syntax &lt;code&gt;{call storedobject(?)}&lt;/code&gt; . The &lt;code&gt;escapeSyntaxCallMode&lt;/code&gt; connection property controls how the driver&#xA;transforms the call syntax to invoke functions or procedures.&lt;/p&gt;&#xA;&lt;p&gt;The default mode, &lt;code&gt;select&lt;/code&gt; , supports backwards compatibility for existing applications and supports function invocation&#xA;only. This is required to invoke a function returning void.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Storing Binary Data</title>
				<link>https://jdbc.postgresql.org/documentation/binary-data/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/binary-data/</guid>
				<description>&lt;p&gt;PostgreSQL® provides two distinct ways to store binary data.  Binary data can be stored in a table using the data type&#xA;BYTEA or by using the Large Object feature which stores the binary data in a separate table in a special format and refers&#xA;to that table by storing a value of type OID in your table.&lt;/p&gt;&#xA;&lt;p&gt;In order to determine which method is appropriate you need to understand the limitations of each method. The BYTEA data&#xA;type is not well suited for storing very large amounts of binary data. While a column of type BYTEA can hold up to 1 GB&#xA;of binary data, it would require a huge amount of memory to process such a large value. The Large Object method for&#xA;storing binary data is better suited to storing very large values, but it has its own limitations.  Specifically deleting&#xA;a row that contains a Large Object reference does not delete the Large Object. Deleting the Large Object is a separate&#xA;operation that needs to be performed. Large Objects also have some security issues since anyone connected to the database&#xA;can view and/or modify any Large Object, even if they don&amp;rsquo;t have permissions to view/update the row containing the&#xA;Large Object reference.&lt;/p&gt;</description>
			</item>
			<item>
				<title>JDBC escapes</title>
				<link>https://jdbc.postgresql.org/documentation/escapes/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/escapes/</guid>
				<description>&lt;p&gt;The JDBC specification (like the ODBC specification) acknowledges the fact that some vendor specific SQL may be required&#xA;for certain RDBMS features. To aid developers in writing portable JDBC applications across multiple database products,&#xA;a special escape syntax is used to specify the generic commands the developer wants to be run. The JDBC driver translates&#xA;these escape sequences into native syntax for its specific database. For more information consult the&#xA;&lt;a href=&#34;http://docs.oracle.com/javadb/10.10.1.2/ref/rrefjdbc1020262.html&#34;&gt;Java DB Technical Documentation&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>PostgreSQL® Extensions to the JDBC API</title>
				<link>https://jdbc.postgresql.org/documentation/server-prepare/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/server-prepare/</guid>
				<description>&lt;p&gt;PostgreSQL® is an extensible database system. You can add your own functions to the server, which can then be called from queries, or even add your own data types. As these are facilities unique to PostgreSQL®, we support them from Java, with a set of extension APIs. Some features within the core of the standard driver actually use these extensions to implement Large Objects, etc.&lt;/p&gt;&#xA;&lt;h2 id=&#34;accessing-the-extensions&#34; class=&#34;self-link&#34;&gt;Accessing the Extensions &lt;a class=&#34;header-link&#34; href=&#34;#accessing-the-extensions&#34;&gt;&#xA;        &lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; width=&#34;24&#34; height=&#34;24&#34;&#xA;            style=&#34;fill: #0093AF;&#34;&gt;&#xA;            &lt;path&#xA;                d=&#34;M8.465 11.293c1.133-1.133 3.109-1.133 4.242 0l.707.707 1.414-1.414-.707-.707c-.943-.944-2.199-1.465-3.535-1.465s-2.592.521-3.535 1.465L4.929 12a5.008 5.008 0 0 0 0 7.071 4.983 4.983 0 0 0 3.535 1.462A4.982 4.982 0 0 0 12 19.071l.707-.707-1.414-1.414-.707.707a3.007 3.007 0 0 1-4.243 0 3.005 3.005 0 0 1 0-4.243l2.122-2.121z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;            &lt;path&#xA;                d=&#34;m12 4.929-.707.707 1.414 1.414.707-.707a3.007 3.007 0 0 1 4.243 0 3.005 3.005 0 0 1 0 4.243l-2.122 2.121c-1.133 1.133-3.109 1.133-4.242 0L10.586 12l-1.414 1.414.707.707c.943.944 2.199 1.465 3.535 1.465s2.592-.521 3.535-1.465L19.071 12a5.008 5.008 0 0 0 0-7.071 5.006 5.006 0 0 0-7.071 0z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;To access some of the extensions, you need to use some extra methods in the &lt;code&gt;org.postgresql.PGConnection&lt;/code&gt; class. In this case, you would need to cast the return value of &lt;code&gt;Driver.getConnection()&lt;/code&gt; . For example:&lt;/p&gt;</description>
			</item>
			<item>
				<title>Using the Driver in a Multithreaded or a Servlet Environment</title>
				<link>https://jdbc.postgresql.org/documentation/thread/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/thread/</guid>
				<description>&lt;p&gt;The PostgreSQL® JDBC driver is not thread safe. The PostgreSQL server is not threaded. Each connection creates a new process&#xA;on the server as such any concurrent requests to the process would have to be serialized. The driver makes no guarantees&#xA;that methods on connections are synchronized. It will be up to the caller to synchronize calls to the driver.&lt;/p&gt;&#xA;&lt;p&gt;A notable exception is &lt;code&gt;org/postgresql/jdbc/TimestampUtils.java&lt;/code&gt; which is threadsafe.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Connection Pools and Data Sources</title>
				<link>https://jdbc.postgresql.org/documentation/datasource/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/datasource/</guid>
				<description>&lt;p&gt;JDBC 2 introduced standard connection pooling features in an add-on API known as the JDBC 2.0 Optional Package&#xA;(also known as the JDBC 2.0 Standard Extension). These features have since been included in the core JDBC 3 API.&lt;/p&gt;&#xA;&lt;p&gt;The JDBC API provides a client and a server interface for connection pooling. The client interface is &lt;code&gt;javax.sql.DataSource&lt;/code&gt;,&#xA;which is what application code will typically use to acquire a pooled database connection. The server interface is&#xA;&lt;code&gt;javax.sql.ConnectionPoolDataSource&lt;/code&gt; , which is how most application servers will interface with the PostgreSQL® JDBC driver.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Logging using java.util.logging</title>
				<link>https://jdbc.postgresql.org/documentation/logging/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/logging/</guid>
				<description>&lt;p&gt;The PostgreSQL® JDBC Driver supports the use of logging (or tracing) to help resolve issues with the&#xA;pgJDBC Driver when is used in your application.&lt;/p&gt;&#xA;&lt;p&gt;The pgJDBC Driver uses the logging APIs of &lt;code&gt;java.util.logging&lt;/code&gt; that is part of Java since JDK 1.4, which makes it a good&#xA;choice for the driver since it doesn&amp;rsquo;t add any external dependency for a logging framework. &lt;code&gt;java.util.logging&lt;/code&gt; is a very&#xA;rich and powerful tool, it&amp;rsquo;s beyond the scope of these docs to explain how to use it to it&amp;rsquo;s full potential, for that&#xA;please refer to &lt;a href=&#34;https://docs.oracle.com/javase/8/docs/technotes/guides/logging/overview.html&#34;&gt;Java Logging Overview&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Further Reading</title>
				<link>https://jdbc.postgresql.org/documentation/reading/</link>
				<pubDate>Sun, 19 Jun 2022 22:46:55 +0530</pubDate>
				<guid>https://jdbc.postgresql.org/documentation/reading/</guid>
				<description>&lt;p&gt;If you have not yet read it, you are advised you read the JDBC API Documentation (supplied with Oracle&amp;rsquo;s JDK) and the&#xA;JDBC Specification.  Both are available from &lt;a href=&#34;http://www.oracle.com/technetwork/java/javase/jdbc/index.html&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://jdbc.postgresql.org/index.html&#34;&gt;Docs&lt;/a&gt; contains updated information not included in this manual including Javadoc&#xA;class documentation and a FAQ. Additionally, it offers precompiled drivers.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
