<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:old.nabble.com,2006:forum-770</id>
	<title>Nabble - PostgreSQL - jdbc</title>
	<updated>2009-11-25T06:03:43Z</updated>
	<link rel="self" type="application/atom+xml" href="http://old.nabble.com/PostgreSQL---jdbc-f770.xml" />
	<link rel="alternate" type="text/html" href="http://old.nabble.com/PostgreSQL---jdbc-f770.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:old.nabble.com,2006:post-26513183</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T06:03:43Z</published>
	<updated>2009-11-25T06:03:43Z</updated>
	<author>
		<name>tkellerer</name>
	</author>
	<content type="html">Oliver Jowett, 25.11.2009 14:42:
&lt;br&gt;&amp;gt; You never call getMoreResults(), so you are only looking at a single
&lt;br&gt;&amp;gt; result, which is either a resultset or an update count, never both.
&lt;br&gt;[...]
&lt;br&gt;Hmm, sorry I missed that in my initial email then. I did call getMoreResults() 
&lt;br&gt;&lt;br&gt;The following still returns false for getMoreResults()
&lt;br&gt;&lt;br&gt;PreparedStatement pstmt = con.prepareStatement(update);
&lt;br&gt;pstmt.setInt(1, 1);
&lt;br&gt;boolean hasResult = pstmt.execute();
&lt;br&gt;&lt;br&gt;if (hasResult ) {
&lt;br&gt;&amp;nbsp; ResultSet rs = pstmt.getResultSet();
&lt;br&gt;&amp;nbsp; if (rs != null &amp;&amp; rs.next()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; int newId = rs.getInt(1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;newid: &amp;quot; + newId);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;boolean more = pstmt.getMoreResults(); // returns false
&lt;br&gt;&lt;br&gt;&amp;gt; You may have more success using something like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; PreparedStatement pstmt = con.prepareStatement(&amp;quot;UPDATE something with no RETURNING clause&amp;quot;, new String[] { &amp;quot;some_column&amp;quot; });
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; int updateCount = pstmt.executeUpdate();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; ResultSet results = pstmt.getGeneratedKeys();
&lt;br&gt;&lt;br&gt;That indeed works!
&lt;br&gt;&lt;br&gt;But I still think the behaviour with getMoreResults() is - at least - confusing ;) 
&lt;br&gt;&lt;br&gt;Thanks a lot for all your patience!
&lt;br&gt;&lt;br&gt;Thomas
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26513183&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26513183.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26512831</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T05:42:27Z</published>
	<updated>2009-11-25T05:42:27Z</updated>
	<author>
		<name>Oliver Jowett</name>
	</author>
	<content type="html">Oliver Jowett wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; You never call getMoreResults(), so you are only looking at a single
&lt;br&gt;&amp;gt; result, which is either a resultset or an update count, never both.
&lt;br&gt;&lt;br&gt;Also, looking at the code a bit more, RETURNING is a bit of a special
&lt;br&gt;case. Normally, if you have a command that returns a resultset, the
&lt;br&gt;command status is ignored (you generally don't care about the command
&lt;br&gt;status of, for example, a SELECT). Presumably that's happening here too.
&lt;br&gt;(But the advice regarding getMoreResults() is generally applicable, e.g.
&lt;br&gt;if you have a multiple-statement query).
&lt;br&gt;&lt;br&gt;You may have more success using something like this:
&lt;br&gt;&lt;br&gt;&amp;gt; &amp;nbsp; PreparedStatement pstmt = con.prepareStatement(&amp;quot;UPDATE something with no RETURNING clause&amp;quot;, new String[] { &amp;quot;some_column&amp;quot; });
&lt;br&gt;&amp;gt; &amp;nbsp; int updateCount = pstmt.executeUpdate();
&lt;br&gt;&amp;gt; &amp;nbsp; ResultSet results = pstmt.getGeneratedKeys();
&lt;br&gt;&lt;br&gt;The driver glues on an appropriate RETURNING clause and arranges for the
&lt;br&gt;resulting resultset to appear via getGeneratedKeys(); the update count
&lt;br&gt;should still appear as expected.
&lt;br&gt;&lt;br&gt;(I haven't actually tried this. caveat emptor)
&lt;br&gt;&lt;br&gt;-O
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26512831&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26512831.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26512430</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T05:14:24Z</published>
	<updated>2009-11-25T05:14:24Z</updated>
	<author>
		<name>Oliver Jowett</name>
	</author>
	<content type="html">Thomas Kellerer wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Back to my original question then: why doesn't the Postgres driver
&lt;br&gt;&amp;gt; return 1 as the updateCount in this situation?
&lt;br&gt;&amp;gt; I only get a single result set (which is correct) but never a 1 as the
&lt;br&gt;&amp;gt; update count.
&lt;br&gt;&lt;br&gt;Back to my original answer then ;-)
&lt;br&gt;&lt;br&gt;Quoting your original code:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; PreparedStatement pstmt = con.prepareStatement(UPDATE_SQL); // the statement from above
&lt;br&gt;&amp;gt; pstmt.setInt(1, 42);
&lt;br&gt;&amp;gt; boolean hasResult = pstmt.execute();
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; if (hasResult) {
&lt;br&gt;&amp;gt; &amp;nbsp;ResultSet rs = pstmt.getResultSet();
&lt;br&gt;&amp;gt; &amp;nbsp;if (rs != null &amp;&amp; rs.next()) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;int newId = rs.getInt(1);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;System.out.println(&amp;quot;newid: &amp;quot; + newId);
&lt;br&gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; int affected = pstmt.getUpdateCount();
&lt;br&gt;&amp;gt; System.out.println(&amp;quot;affected: &amp;quot; + affected); 
&lt;/div&gt;&lt;br&gt;You never call getMoreResults(), so you are only looking at a single
&lt;br&gt;result, which is either a resultset or an update count, never both.
&lt;br&gt;&lt;br&gt;-O
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26512430&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26512430.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26511818</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T04:30:17Z</published>
	<updated>2009-11-25T04:30:17Z</updated>
	<author>
		<name>tkellerer</name>
	</author>
	<content type="html">Oliver Jowett, 25.11.2009 13:16:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; So if I create a loop using the condition stated in the Javadocs the
&lt;br&gt;&amp;gt;&amp;gt; program flow would be as follows:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 1) stmt.execute() returns true, so I call getResultSet()
&lt;br&gt;&amp;gt;&amp;gt; 2) getMoreResults() returns false, but getUpdateCount() returns 3 ==&amp;gt; go on
&lt;br&gt;&amp;gt;&amp;gt; 3) getMoreResults() returns false, but getUpdateCount() returns 2 ==&amp;gt; go on
&lt;br&gt;&amp;gt;&amp;gt; 4) getMoreResults() returns true, so getResultSet() returns a result set
&lt;br&gt;&amp;gt;&amp;gt; ==&amp;gt; go on
&lt;br&gt;&amp;gt;&amp;gt; 5) getMoreResults() returns true, so getResultSet() returns a result set
&lt;br&gt;&amp;gt;&amp;gt; ==&amp;gt; go on
&lt;br&gt;&amp;gt;&amp;gt; 6) getMoreResults() returns false, getUpdateCount() returns -1 ==&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; everything was processed.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Yes, this is correct. It will look something like this:
&lt;/div&gt;&lt;br&gt;So my understanding was correct ;)
&lt;br&gt;&lt;br&gt;Back to my original question then: why doesn't the Postgres driver return 1 as the updateCount in this situation? 
&lt;br&gt;&lt;br&gt;I only get a single result set (which is correct) but never a 1 as the update count.
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Thomas
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26511818&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26511818.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26511684</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T04:16:20Z</published>
	<updated>2009-11-25T04:16:20Z</updated>
	<author>
		<name>Oliver Jowett</name>
	</author>
	<content type="html">Thomas Kellerer wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Oliver Jowett, 25.11.2009 12:13:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; You've done some selective editing there. The javadoc I referred to is
&lt;br&gt;&amp;gt;&amp;gt; this (from the Java 6 javadoc):
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; getResultSet():
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Retrieves the current result as a ResultSet object. This method should
&lt;br&gt;&amp;gt;&amp;gt; be called only once per result.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Correct, once per *result* not per statement. If the statement returns
&lt;br&gt;&amp;gt; more than one result, I should be allowed to call it multiple time.
&lt;/div&gt;&lt;br&gt;That's right, but you need a call to getMoreResults() to step through
&lt;br&gt;the results between calls, as I suggested in my original response.
&lt;br&gt;&lt;br&gt;&amp;gt; I think the base of my (mis)understanding is that the term &amp;quot;current&amp;quot;
&lt;br&gt;&amp;gt; lead me to believe that the &amp;quot;stack&amp;quot; of results a statement can hold,
&lt;br&gt;&amp;gt; could look like this:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; resultSet
&lt;br&gt;&amp;gt; update count = 3
&lt;br&gt;&amp;gt; update count = 2
&lt;br&gt;&amp;gt; resultSet
&lt;br&gt;&amp;gt; reslutSet
&lt;br&gt;&lt;br&gt;Yes, you can have that. You step through the results by calling
&lt;br&gt;getMoreResults(). At any particular point, the current result is either
&lt;br&gt;a resultset or an update count, but never both.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; So if I create a loop using the condition stated in the Javadocs the
&lt;br&gt;&amp;gt; program flow would be as follows:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 1) stmt.execute() returns true, so I call getResultSet()
&lt;br&gt;&amp;gt; 2) getMoreResults() returns false, but getUpdateCount() returns 3 ==&amp;gt; go on
&lt;br&gt;&amp;gt; 3) getMoreResults() returns false, but getUpdateCount() returns 2 ==&amp;gt; go on
&lt;br&gt;&amp;gt; 4) getMoreResults() returns true, so getResultSet() returns a result set
&lt;br&gt;&amp;gt; ==&amp;gt; go on
&lt;br&gt;&amp;gt; 5) getMoreResults() returns true, so getResultSet() returns a result set
&lt;br&gt;&amp;gt; ==&amp;gt; go on
&lt;br&gt;&amp;gt; 6) getMoreResults() returns false, getUpdateCount() returns -1 ==&amp;gt;
&lt;br&gt;&amp;gt; everything was processed.
&lt;/div&gt;&lt;br&gt;Yes, this is correct. It will look something like this:
&lt;br&gt;&lt;br&gt;boolean hasResultSet = stmt.execute();
&lt;br&gt;int updateCount = stmt.getUpdateCount();
&lt;br&gt;while (hasResultSet || updateCount != -1) {
&lt;br&gt;&amp;nbsp; if (hasResultSet) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; ResultSet rs = stmt.getResultSet();
&lt;br&gt;&amp;nbsp; &amp;nbsp; // This result is a resultset, process rs.
&lt;br&gt;&amp;nbsp; } else {
&lt;br&gt;&amp;nbsp; &amp;nbsp; // This result is an update count, process updateCount.
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; hasResultSet = stmt.getMoreResults();
&lt;br&gt;&amp;nbsp; updateCount = stmt.getUpdateCount();
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;-O
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26511684&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26511684.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26511428</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T03:53:17Z</published>
	<updated>2009-11-25T03:53:17Z</updated>
	<author>
		<name>tkellerer</name>
	</author>
	<content type="html">Oliver Jowett, 25.11.2009 12:13:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; You've done some selective editing there. The javadoc I referred to is 
&lt;br&gt;&amp;gt; this (from the Java 6 javadoc):
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; getResultSet():
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Retrieves the current result as a ResultSet object. This method should 
&lt;br&gt;&amp;gt; be called only once per result.
&lt;br&gt;&lt;br&gt;Correct, once per *result* not per statement. If the statement returns more than one result, I should be allowed to call it multiple time. 
&lt;br&gt;&lt;br&gt;I think the base of my (mis)understanding is that the term &amp;quot;current&amp;quot; lead me to believe that the &amp;quot;stack&amp;quot; of results a statement can hold, could look like this:
&lt;br&gt;&lt;br&gt;resultSet
&lt;br&gt;update count = 3
&lt;br&gt;update count = 2
&lt;br&gt;resultSet
&lt;br&gt;reslutSet
&lt;br&gt;&lt;br&gt;So if I create a loop using the condition stated in the Javadocs the program flow would be as follows:
&lt;br&gt;&lt;br&gt;1) stmt.execute() returns true, so I call getResultSet()
&lt;br&gt;2) getMoreResults() returns false, but getUpdateCount() returns 3 ==&amp;gt; go on
&lt;br&gt;3) getMoreResults() returns false, but getUpdateCount() returns 2 ==&amp;gt; go on
&lt;br&gt;4) getMoreResults() returns true, so getResultSet() returns a result set ==&amp;gt; go on
&lt;br&gt;5) getMoreResults() returns true, so getResultSet() returns a result set ==&amp;gt; go on
&lt;br&gt;6) getMoreResults() returns false, getUpdateCount() returns -1 ==&amp;gt; everything was processed. 
&lt;br&gt;&lt;br&gt;Apparently this interpretation of &amp;quot;current&amp;quot;, &amp;quot;next&amp;quot; and &amp;quot;once per _result_&amp;quot; was wrong...
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Thomas
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26511428&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26511428.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26510968</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-25T03:13:40Z</published>
	<updated>2009-11-25T03:13:40Z</updated>
	<author>
		<name>Oliver Jowett</name>
	</author>
	<content type="html">Thomas Kellerer wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hmm, my understand was a bit different.
&lt;br&gt;&amp;gt; The Javadocs simply say
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; There are no more results when the following is true:
&lt;br&gt;&amp;gt; ((stmt.getMoreResults() == false) &amp;&amp; (stmt.getUpdateCount() == -1))
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; It doesn't state that they are mutually exclusive. And for me it seemed 
&lt;br&gt;&amp;gt; to imply that I can call getMoreResults() and getUpdateCount() in a loop 
&lt;br&gt;&amp;gt; in order to process everything that is returned.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Additionally the Javadocs for getUpdateCount() says:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;quot;Gets the *current* result as an update count&amp;quot; and &amp;quot;.. if there are no 
&lt;br&gt;&amp;gt; more results it returns -1&amp;quot;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;You've done some selective editing there. The javadoc I referred to is 
&lt;br&gt;this (from the Java 6 javadoc):
&lt;br&gt;&lt;br&gt;getResultSet():
&lt;br&gt;&lt;br&gt;Retrieves the current result as a ResultSet object. This method should 
&lt;br&gt;be called only once per result.
&lt;br&gt;&lt;br&gt;Returns: the current result as a ResultSet object or null if the result 
&lt;br&gt;is an update count or there are no more results
&lt;br&gt;&lt;br&gt;---
&lt;br&gt;&lt;br&gt;getUpdateCount():
&lt;br&gt;&lt;br&gt;Retrieves the current result as an update count; if the result is a 
&lt;br&gt;ResultSet object or there are no more results, -1 is returned. This 
&lt;br&gt;method should be called only once per result.
&lt;br&gt;&lt;br&gt;Returns: the current result as an update count; -1 if the current result 
&lt;br&gt;is a ResultSet object or there are no more results
&lt;br&gt;&lt;br&gt;---
&lt;br&gt;&lt;br&gt;I think that's fairly clear: the &amp;quot;current result&amp;quot; is either a ResultSet, 
&lt;br&gt;or an update count, but it can't be both. getUpdateCount() explicitly 
&lt;br&gt;says that it returns &amp;quot;-1 [...] if the current result is a ResultSet 
&lt;br&gt;object&amp;quot;, and getResultSet() explicitly says that it returns &amp;quot;null if the 
&lt;br&gt;[current] result is an update count.&amp;quot;
&lt;br&gt;&lt;br&gt;&amp;gt; The word &amp;quot;current&amp;quot; here also let me to believe I can call those methods 
&lt;br&gt;&amp;gt; multiple times.
&lt;br&gt;&lt;br&gt;&amp;nbsp;From memory the postgresql driver doesn't care if you call them 
&lt;br&gt;multiple times, but FWIW the javadoc says that you should only call them 
&lt;br&gt;once per result.
&lt;br&gt;&lt;br&gt;-O
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26510968&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26510968.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26508566</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-24T23:31:37Z</published>
	<updated>2009-11-24T23:31:37Z</updated>
	<author>
		<name>tkellerer</name>
	</author>
	<content type="html">Oliver Jowett, 25.11.2009 01:40:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Thomas Kellerer wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt;&amp;gt; boolean hasResult = pstmt.execute();
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; if (hasResult) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;ResultSet rs = pstmt.getResultSet();
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;if (rs != null &amp;&amp; rs.next()) {
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;int newId = rs.getInt(1);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;System.out.println(&amp;quot;newid: &amp;quot; + newId);
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; int affected = pstmt.getUpdateCount();
&lt;br&gt;&amp;gt;&amp;gt; System.out.println(&amp;quot;affected: &amp;quot; + affected);
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I do see the returned ID from the ResultSet but getUpdateCount() always
&lt;br&gt;&amp;gt;&amp;gt; returns -1 even though I know that a row was updated.
&lt;br&gt;&amp;gt;&amp;gt; What am I missing here?
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Update counts and result sets (for a particular result) are mutually
&lt;br&gt;&amp;gt; exclusive. If getResultSet() returns non-null then getUpdateCount() must
&lt;br&gt;&amp;gt; return -1; see the javadoc for those two methods.
&lt;/div&gt;&lt;br&gt;Hmm, my understand was a bit different. 
&lt;br&gt;&lt;br&gt;The Javadocs simply say
&lt;br&gt;&lt;br&gt;There are no more results when the following is true:
&lt;br&gt;((stmt.getMoreResults() == false) &amp;&amp; (stmt.getUpdateCount() == -1))
&lt;br&gt;&lt;br&gt;It doesn't state that they are mutually exclusive. And for me it seemed to imply that I can call getMoreResults() and getUpdateCount() in a loop in order to process everything that is returned.
&lt;br&gt;&lt;br&gt;Additionally the Javadocs for getUpdateCount() says:
&lt;br&gt;&lt;br&gt;&amp;quot;Gets the *current* result as an update count&amp;quot; and &amp;quot;.. if there are no more results it returns -1&amp;quot;
&lt;br&gt;&lt;br&gt;The word &amp;quot;current&amp;quot; here also let me to believe I can call those methods multiple times. 
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Thomas
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26508566&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26508566.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26506063</id>
	<title>Re: getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-24T16:40:30Z</published>
	<updated>2009-11-24T16:40:30Z</updated>
	<author>
		<name>Oliver Jowett</name>
	</author>
	<content type="html">Thomas Kellerer wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; boolean hasResult = pstmt.execute();
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; if (hasResult) {
&lt;br&gt;&amp;gt; &amp;nbsp;ResultSet rs = pstmt.getResultSet();
&lt;br&gt;&amp;gt; &amp;nbsp;if (rs != null &amp;&amp; rs.next()) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;int newId = rs.getInt(1);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;System.out.println(&amp;quot;newid: &amp;quot; + newId);
&lt;br&gt;&amp;gt; &amp;nbsp;}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; int affected = pstmt.getUpdateCount();
&lt;br&gt;&amp;gt; System.out.println(&amp;quot;affected: &amp;quot; + affected);
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I do see the returned ID from the ResultSet but getUpdateCount() always
&lt;br&gt;&amp;gt; returns -1 even though I know that a row was updated.
&lt;br&gt;&amp;gt; What am I missing here?
&lt;/div&gt;&lt;br&gt;Update counts and result sets (for a particular result) are mutually
&lt;br&gt;exclusive. If getResultSet() returns non-null then getUpdateCount() must
&lt;br&gt;return -1; see the javadoc for those two methods.
&lt;br&gt;&lt;br&gt;You probably want to call getMoreResults() in there somewhere to step to
&lt;br&gt;the next result.
&lt;br&gt;&lt;br&gt;-O
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26506063&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26506063.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26494529</id>
	<title>getUdateCount() vs. RETURNING clause</title>
	<published>2009-11-24T03:45:26Z</published>
	<updated>2009-11-24T03:45:26Z</updated>
	<author>
		<name>tkellerer</name>
	</author>
	<content type="html">Hi, 
&lt;br&gt;&lt;br&gt;I'm having a problem using an UPDATE statement with a RETURNING clause.
&lt;br&gt;&lt;br&gt;It seems I cannot retrieve the number of rows affected using getUpdateCount()
&lt;br&gt;&lt;br&gt;This is my statement
&lt;br&gt;&lt;br&gt;UPDATE my_table
&lt;br&gt;&amp;nbsp; SET the_column = the_column + 1
&lt;br&gt;&amp;nbsp; WHERE id = =
&lt;br&gt;&amp;nbsp; RETURNING the_column;
&lt;br&gt;&lt;br&gt;My Java code is:
&lt;br&gt;&lt;br&gt;PreparedStatement pstmt = con.prepareStatement(UPDATE_SQL); // the statement from above
&lt;br&gt;pstmt.setInt(1, 42);
&lt;br&gt;boolean hasResult = pstmt.execute();
&lt;br&gt;&lt;br&gt;if (hasResult) {
&lt;br&gt;&amp;nbsp; ResultSet rs = pstmt.getResultSet();
&lt;br&gt;&amp;nbsp; if (rs != null &amp;&amp; rs.next()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; int newId = rs.getInt(1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; System.out.println(&amp;quot;newid: &amp;quot; + newId);
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;int affected = pstmt.getUpdateCount();
&lt;br&gt;System.out.println(&amp;quot;affected: &amp;quot; + affected);
&lt;br&gt;&lt;br&gt;I do see the returned ID from the ResultSet but getUpdateCount() always returns -1 even though I know that a row was updated. 
&lt;br&gt;&lt;br&gt;What am I missing here?
&lt;br&gt;&lt;br&gt;My Postgres version is: 8.4.1 
&lt;br&gt;My driver version is: PostgreSQL 8.4 JDBC4 (build 701)
&lt;br&gt;I'm using Java6 (1.6.0_16)
&lt;br&gt;&lt;br&gt;Regards
&lt;br&gt;Thomas
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26494529&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/getUdateCount%28%29-vs.-RETURNING-clause-tp26494529p26494529.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26452083</id>
	<title>Re: COPY and turning off autocommit</title>
	<published>2009-11-20T15:45:57Z</published>
	<updated>2009-11-20T15:45:57Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Thu, 19 Nov 2009, Maciek Sakrejda wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; The attached fixes the issue by adapting the internal API to mimic the
&lt;br&gt;&amp;gt; Fastpath subprotocol with respect to transactions. It does not include
&lt;br&gt;&amp;gt; the test patch above.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Any thoughts?
&lt;br&gt;&lt;br&gt;This looks like the right approach at a quick glance. &amp;nbsp;I'm going on 
&lt;br&gt;vacation next week, but when I return I will review and commit.
&lt;br&gt;&lt;br&gt;Kris Jurka
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26452083&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/COPY-and-turning-off-autocommit-tp26394424p26452083.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26434368</id>
	<title>Re: COPY and turning off autocommit</title>
	<published>2009-11-19T13:25:13Z</published>
	<updated>2009-11-19T13:25:13Z</updated>
	<author>
		<name>Maciek Sakrejda</name>
	</author>
	<content type="html">The attached fixes the issue by adapting the internal API to mimic the
&lt;br&gt;Fastpath subprotocol with respect to transactions. It does not include
&lt;br&gt;the test patch above.
&lt;br&gt;&lt;br&gt;The full suite (with the added test) passes with postgresql 8.3 under
&lt;br&gt;both Java 5 and 6. I don't have 1.4 handy, but I did make the
&lt;br&gt;necessary (trivial) change to the v2 QueryExecutorImpl.
&lt;br&gt;&lt;br&gt;Any thoughts?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Maciek Sakrejda | Software Engineer | Truviso
&lt;br&gt;&lt;br&gt;1065 E. Hillsdale Blvd., Suite 230
&lt;br&gt;Foster City, CA 94404
&lt;br&gt;(650) 242-3500 Main
&lt;br&gt;(650) 242-3501 F
&lt;br&gt;www.truviso.com
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[copy-tx-fix.patch]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;Index: org/postgresql/core/QueryExecutor.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/QueryExecutor.java,v
&lt;br&gt;retrieving revision 1.44
&lt;br&gt;diff -r1.44 QueryExecutor.java
&lt;br&gt;223c223
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; CopyOperation startCopy(String sql) throws SQLException;
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException;
&lt;br&gt;Index: org/postgresql/core/v2/QueryExecutorImpl.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v2/QueryExecutorImpl.java,v
&lt;br&gt;retrieving revision 1.22
&lt;br&gt;diff -r1.22 QueryExecutorImpl.java
&lt;br&gt;610c610
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; public CopyOperation startCopy(String sql) throws SQLException {
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException {
&lt;br&gt;Index: org/postgresql/core/v3/QueryExecutorImpl.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/core/v3/QueryExecutorImpl.java,v
&lt;br&gt;retrieving revision 1.45
&lt;br&gt;diff -r1.45 QueryExecutorImpl.java
&lt;br&gt;475c475,492
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() == ProtocolConnection.TRANSACTION_IDLE &amp;&amp; !suppressBegin)
&lt;br&gt;---
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!suppressBegin)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doSubprotocolBegin();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sendFastpathCall(fnid, (SimpleParameterList)parameters);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return receiveFastpathResult();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (IOException ioe)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; protoConnection.close();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;An I/O error occured while sending to the backend.&amp;quot;), PSQLState.CONNECTION_FAILURE, ioe);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void doSubprotocolBegin() throws SQLException {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() == ProtocolConnection.TRANSACTION_IDLE)
&lt;/div&gt;479c496
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; logger.debug(&amp;quot;Issuing BEGIN before fastpath call.&amp;quot;);
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; logger.debug(&amp;quot;Issuing BEGIN before fastpath or copy call.&amp;quot;);
&lt;br&gt;540,549d556
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sendFastpathCall(fnid, (SimpleParameterList)parameters);
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return receiveFastpathResult();
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (IOException ioe)
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; protoConnection.close();
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;An I/O error occured while sending to the backend.&amp;quot;), PSQLState.CONNECTION_FAILURE, ioe);
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;702c709
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; public synchronized CopyOperation startCopy(String sql) throws SQLException {
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException {
&lt;br&gt;703a711,713
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!suppressBegin) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doSubprotocolBegin();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;Index: org/postgresql/copy/CopyManager.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/copy/CopyManager.java,v
&lt;br&gt;retrieving revision 1.1
&lt;br&gt;diff -r1.1 CopyManager.java
&lt;br&gt;42a43
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; private final BaseConnection connection;
&lt;br&gt;46a48
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.connection = connection;
&lt;br&gt;52c54
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; op = queryExecutor.startCopy(sql);
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; op = queryExecutor.startCopy(sql, connection.getAutoCommit());
&lt;br&gt;63c65
&lt;br&gt;&amp;lt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; op = queryExecutor.startCopy(sql);
&lt;br&gt;---
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; op = queryExecutor.startCopy(sql, connection.getAutoCommit());
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26434368&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/COPY-and-turning-off-autocommit-tp26394424p26434368.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26433979</id>
	<title>Re: COPY and turning off autocommit</title>
	<published>2009-11-19T12:50:16Z</published>
	<updated>2009-11-19T12:50:16Z</updated>
	<author>
		<name>Maciek Sakrejda</name>
	</author>
	<content type="html">This time with attachment.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Maciek Sakrejda | Software Engineer | Truviso
&lt;br&gt;&lt;br&gt;1065 E. Hillsdale Blvd., Suite 230
&lt;br&gt;Foster City, CA 94404
&lt;br&gt;(650) 242-3500 Main
&lt;br&gt;(650) 242-3501 F
&lt;br&gt;www.truviso.com
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[copy-tx-test.patch]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;Index: org/postgresql/test/jdbc2/CopyTest.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/test/jdbc2/CopyTest.java,v
&lt;br&gt;retrieving revision 1.2
&lt;br&gt;diff -r1.2 CopyTest.java
&lt;br&gt;259a260,266
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public void testCopyRollback() throws SQLException {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.setAutoCommit(false);
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; testCopyInByRow();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.rollback();
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; assertEquals(0, getCount());
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; 
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26433979&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/COPY-and-turning-off-autocommit-tp26394424p26433979.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26433813</id>
	<title>Re: COPY and turning off autocommit</title>
	<published>2009-11-19T12:46:08Z</published>
	<updated>2009-11-19T12:46:08Z</updated>
	<author>
		<name>Maciek Sakrejda</name>
	</author>
	<content type="html">Attaching a patch to add a failing test case that illustrates the
&lt;br&gt;problem against CVS HEAD.
&lt;br&gt;&lt;br&gt;I'll try mucking about with the possible answers to my above questions
&lt;br&gt;and see if I can get the suite to pass, but I'd appreciate feedback
&lt;br&gt;from anyone more familiar with the protocol.
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;--
&lt;br&gt;Maciek Sakrejda | Software Engineer | Truviso
&lt;br&gt;&lt;br&gt;1065 E. Hillsdale Blvd., Suite 230
&lt;br&gt;Foster City, CA 94404
&lt;br&gt;(650) 242-3500 Main
&lt;br&gt;(650) 242-3501 F
&lt;br&gt;www.truviso.com
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26433813&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/COPY-and-turning-off-autocommit-tp26394424p26433813.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26430031</id>
	<title>Re: commit and rollback don't throw exceptions when    they should</title>
	<published>2009-11-19T09:01:18Z</published>
	<updated>2009-11-19T09:01:18Z</updated>
	<author>
		<name>Kevin Grittner</name>
	</author>
	<content type="html">Kris Jurka &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26430031&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;books@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; Thanks for following up on this.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Thank you for taking it all the way to what it should have been in the
&lt;br&gt;first place. &amp;nbsp;I've got to try to overcome this tendency to submit the
&lt;br&gt;minimum patch that will directly address a complaint. &amp;nbsp;I should be
&lt;br&gt;willing to dive in and deal with the entire set of related issues, as
&lt;br&gt;you do.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-Kevin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26430031&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/commit-and-rollback-don%27t-throw-exceptions-when-they-should-tp25981287p26430031.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26418648</id>
	<title>Re: commit and rollback don't throw exceptions when    they should</title>
	<published>2009-11-18T16:59:57Z</published>
	<updated>2009-11-18T16:59:57Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Wed, 18 Nov 2009, Kevin Grittner wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; That all makes sense. &amp;nbsp;I think you have a copy/paste error in the
&lt;br&gt;&amp;gt; exception message, though: &amp;quot;This statement has been closed.&amp;quot; &amp;nbsp;It is
&lt;br&gt;&amp;gt; the connection which has been closed here.
&lt;br&gt;&lt;br&gt;Doh! Fixed.
&lt;br&gt;&lt;br&gt;&amp;gt; Also, for software which tries to make sense of the SQLSTATE for
&lt;br&gt;&amp;gt; automated handling, I'm inclined to think that something in Class Code
&lt;br&gt;&amp;gt; '08' (Connection Exception) would be more useful than the Class Code
&lt;br&gt;&amp;gt; '55' (Object Not in Prerequisite State) value. &amp;nbsp;Granted, it's a gray
&lt;br&gt;&amp;gt; area, since the problem with the connection is that it's not in an
&lt;br&gt;&amp;gt; open state....
&lt;br&gt;&lt;br&gt;I've changed it to 08003 CONNECTION_DOES_NOT_EXIST. &amp;nbsp;We're already using 
&lt;br&gt;it for this purpose (already closed) in the connection pooling code.
&lt;br&gt;&lt;br&gt;Thanks for following up on this.
&lt;br&gt;&lt;br&gt;Kris Jurka
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26418648&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/commit-and-rollback-don%27t-throw-exceptions-when-they-should-tp25981287p26418648.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26414198</id>
	<title>Re: commit and rollback don't throw exceptions when   they should</title>
	<published>2009-11-18T11:31:32Z</published>
	<updated>2009-11-18T11:31:32Z</updated>
	<author>
		<name>Kevin Grittner</name>
	</author>
	<content type="html">Kris Jurka &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26414198&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;books@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; I've commited a modified version of this patch to HEAD only,
&lt;br&gt;&amp;gt; because changing this behavior could break peoples applications.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I extended the check for the connection already being closed to the
&lt;br&gt;&amp;gt; other connection methods. &amp;nbsp;There's no reason commit/rollback are
&lt;br&gt;&amp;gt; special here.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;That all makes sense. &amp;nbsp;I think you have a copy/paste error in the
&lt;br&gt;exception message, though: &amp;quot;This statement has been closed.&amp;quot; &amp;nbsp;It is
&lt;br&gt;the connection which has been closed here.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Also, for software which tries to make sense of the SQLSTATE for
&lt;br&gt;automated handling, I'm inclined to think that something in Class Code
&lt;br&gt;'08' (Connection Exception) would be more useful than the Class Code
&lt;br&gt;'55' (Object Not in Prerequisite State) value. &amp;nbsp;Granted, it's a gray
&lt;br&gt;area, since the problem with the connection is that it's not in an
&lt;br&gt;open state....
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-Kevin
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26414198&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/commit-and-rollback-don%27t-throw-exceptions-when-they-should-tp25981287p26414198.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26408924</id>
	<title>Re: [BUGS] BUG #5177: Concurrency problem in AbstractJdbc23PooledConnection</title>
	<published>2009-11-18T06:29:50Z</published>
	<updated>2009-11-18T06:29:50Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Tue, 10 Nov 2009, Mauro Molinari wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Bug reference: &amp;nbsp; &amp;nbsp; &amp;nbsp;5177
&lt;br&gt;&amp;gt; PostgreSQL version: 8.3.8
&lt;br&gt;&amp;gt; Description: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Concurrency problem in AbstractJdbc23PooledConnection
&lt;br&gt;&amp;gt; Details:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Hello, we're using PostgreSQL JDBC3 driver 8.3-605 to connect to a 8.3.8
&lt;br&gt;&amp;gt; Postgres instance. Our application has a JTA-XA transaction infrastructure
&lt;br&gt;&amp;gt; managed by Spring and using JBoss Transactions as a JTA implementation.
&lt;br&gt;&amp;gt; We're using a connection pool of our own to pool XA connections on top of
&lt;br&gt;&amp;gt; which there's JBoss Transactions transactional driver that is managing
&lt;br&gt;&amp;gt; connections. Our connection pool infrastructure creates a PGXADataSource
&lt;br&gt;&amp;gt; from which it gets new XA connections.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; In this scenario, sometimes happens that the PostgreSQL driver fails with
&lt;br&gt;&amp;gt; the following exception:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; java.lang.NullPointerException
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection$ConnectionHandler.in
&lt;br&gt;&amp;gt; voke(AbstractJdbc23PooledConnection.java:319)
&lt;br&gt;&amp;gt; &amp;nbsp;at $Proxy5.close(Unknown Source)
&lt;br&gt;&amp;gt; &amp;nbsp;at
&lt;br&gt;&amp;gt; com.arjuna.ats.internal.jdbc.ConnectionImple.close(ConnectionImple.java:369)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Looking at the JDBC driver source code, it seems a concurrency problem,
&lt;br&gt;&amp;gt; because at row 304-305 the variable con is checked against null.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; What is actually happening here is that our code is closing a connection
&lt;br&gt;&amp;gt; used to read some data from the DB. This read operation is executed outside
&lt;br&gt;&amp;gt; any transaction, so JBoss Transactions is honouring the connection close
&lt;br&gt;&amp;gt; request by first calling calling close on the XA connection (and this is
&lt;br&gt;&amp;gt; causing the XA connection to be given back to our pool); after that, because
&lt;br&gt;&amp;gt; of the actual JDBC connection reports false on isClosed(), JBoss
&lt;br&gt;&amp;gt; Transactions is also calling close() on it too... and this generates the
&lt;br&gt;&amp;gt; NullPointerException given above.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Looking at the AbstractJdbc23PooledConnection it seems there's no
&lt;br&gt;&amp;gt; synchronization at all between isClosed() and close(). My suspect is that in
&lt;br&gt;&amp;gt; the previous scenario something like this happens:
&lt;br&gt;&amp;gt; 1. thread 1: close() is invoked
&lt;br&gt;&amp;gt; 2. thread 2: isClosed() returns false
&lt;br&gt;&amp;gt; 3. thread 2: close() is invoked
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; At operation 2., isClose returns false, while it should return true because
&lt;br&gt;&amp;gt; a close request has already been made on thread 1. Anyway, there should be
&lt;br&gt;&amp;gt; no problem at all to call close repeatedly on the same connection (as the
&lt;br&gt;&amp;gt; JDBC contract states), so the NullPointerException should not happen in any
&lt;br&gt;&amp;gt; case.
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;/div&gt;Attached is a test case which reproduces this problem easily.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&amp;gt; Thanks in advance and please let me know how I can monitor this bug report
&lt;br&gt;&amp;gt; (is there any bug tracking system for PostgreSQL?).
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;There is no bug tracker for postgresql in general. &amp;nbsp;The JDBC driver does 
&lt;br&gt;have a bug tracker, but the mailing list is where most of the action 
&lt;br&gt;happens.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://pgfoundry.org/tracker/?group_id=1000224&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pgfoundry.org/tracker/?group_id=1000224&lt;/a&gt;&lt;br&gt;&lt;br&gt;Kris Jurka&lt;br /&gt;import java.sql.*;
&lt;br&gt;import javax.sql.XAConnection;
&lt;br&gt;&lt;br&gt;import org.postgresql.xa.PGXADataSource;
&lt;br&gt;&lt;br&gt;public class XaCloseTest {
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static void main(String args[]) throws Exception {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PGXADataSource ds = new PGXADataSource();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.setServerName(&amp;quot;localhost&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.setUser(&amp;quot;kjurka&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.setPassword(&amp;quot;&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.setDatabaseName(&amp;quot;kjurka&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.setPortNumber(5850);
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XAConnection xaconn = ds.getXAConnection();
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Handle h = new Handle();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; h.conn = xaconn.getConnection();
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i=0; i&amp;lt;5; i++) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Closer c = new Closer(h);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c.start();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Opener o = new Opener(xaconn, h);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; o.start();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static class Handle {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Connection conn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static class Closer extends Thread {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private final Handle _h;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Closer(Handle h) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _h = h;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (true) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _h.conn.close();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } catch (SQLException sqle) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqle.printStackTrace();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static class Opener extends Thread {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private final XAConnection _xaconn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private final Handle _h;
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Opener(XAConnection xaconn, Handle h) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _xaconn = xaconn;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _h = h;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void run() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (true) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; _h.conn = _xaconn.getConnection();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } catch (SQLException sqle) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sqle.printStackTrace();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;}
&lt;br&gt;&lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26408924&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Re%3A--BUGS--BUG--5177%3A-Concurrency-problem-in-AbstractJdbc23PooledConnection-tp26408924p26408924.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26406125</id>
	<title>Re: commit and rollback don't throw exceptions when   they should</title>
	<published>2009-11-18T03:21:38Z</published>
	<updated>2009-11-18T03:21:38Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Wed, 4 Nov 2009, Kevin Grittner wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; Having received no feedback on the preliminary patch I previously
&lt;br&gt;&amp;gt; posted, I'll suggest this (fairly minimal) patch. &amp;nbsp;I didn't attempt to
&lt;br&gt;&amp;gt; deal with the distributed transaction issue, since it seemed pretty
&lt;br&gt;&amp;gt; messy and I wasn't sure the fix was worth the mess it would make. &amp;nbsp;As
&lt;br&gt;&amp;gt; far as I can see, it should fix the OP's problem, although it would be
&lt;br&gt;&amp;gt; nice to get a confirmation of that.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;I've commited a modified version of this patch to HEAD only, because 
&lt;br&gt;changing this behavior could break peoples applications.
&lt;br&gt;&lt;br&gt;I extended the check for the connection already being closed to the other 
&lt;br&gt;connection methods. &amp;nbsp;There's no reason commit/rollback are special here.
&lt;br&gt;I also needed to fix a regression testcase which was violating this rule.
&lt;br&gt;&lt;br&gt;Kris Jurka
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26406125&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/commit-and-rollback-don%27t-throw-exceptions-when-they-should-tp25981287p26406125.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26394424</id>
	<title>COPY and turning off autocommit</title>
	<published>2009-11-17T09:40:34Z</published>
	<updated>2009-11-17T09:40:34Z</updated>
	<author>
		<name>Maciek Sakrejda</name>
	</author>
	<content type="html">I've found that since COPY does not use the sendQueryPreamble method
&lt;br&gt;in QueryExecutorImpl, it fails to issue the necessary BEGIN if it's
&lt;br&gt;the first statement after autocommit is set to off.
&lt;br&gt;&lt;br&gt;A workaround is to just issue a &amp;quot;SELECT 1&amp;quot; before the COPY, but this
&lt;br&gt;is pretty ugly.
&lt;br&gt;&lt;br&gt;I'm not quite sure what the proper fix is: does COPY need to go
&lt;br&gt;through the full sendQueryPreamble code path (specifically,
&lt;br&gt;processDeadParsedQueries() and processDeadPortals())? Also, that code
&lt;br&gt;is tied into the ResultHandler interface, and COPY does not really fit
&lt;br&gt;well into that paradigm. I don't think we can we just call
&lt;br&gt;sendQueryPreamble(), sendSync(), processResults(), and *then* move to
&lt;br&gt;COPY code, since sendQueryPreamble() might do nothing if we're already
&lt;br&gt;in a transaction. I suppose we could pass in a null ResultHandler and
&lt;br&gt;see if the handler returned is null (in which case there is no BEGIN
&lt;br&gt;to process), but that seems egregiously ugly.
&lt;br&gt;&lt;br&gt;Any thoughts?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Maciek Sakrejda | Software Engineer | Truviso
&lt;br&gt;&lt;br&gt;1065 E. Hillsdale Blvd., Suite 230
&lt;br&gt;Foster City, CA 94404
&lt;br&gt;(650) 242-3500 Main
&lt;br&gt;(650) 242-3501 F
&lt;br&gt;www.truviso.com
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26394424&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/COPY-and-turning-off-autocommit-tp26394424p26394424.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26326644</id>
	<title>Re: Implementation of query timeout</title>
	<published>2009-11-12T13:21:11Z</published>
	<updated>2009-11-12T13:21:11Z</updated>
	<author>
		<name>Radosław Smogura-4</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;Under &lt;a href=&quot;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout_v2_20091112.tar.bz2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout_v2_20091112.tar.bz2&lt;/a&gt;&amp;nbsp;
&lt;br&gt;you can find newer version of statement timeout, witch is bettered propsal of 
&lt;br&gt;solution, but still only from non-batch statements.
&lt;br&gt;&lt;br&gt;Kind regards,
&lt;br&gt;Radek Smogura
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26326644&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Implementation-of-query-timeout-tp26114018p26326644.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26303952</id>
	<title>Re: Read Timeout</title>
	<published>2009-11-11T08:11:40Z</published>
	<updated>2009-11-11T08:11:40Z</updated>
	<author>
		<name>Sadanori Ito</name>
	</author>
	<content type="html">Michael Mangeng wrote:
&lt;br&gt;&amp;nbsp;&amp;gt; My question is weather there is a possibility to define a read timeout
&lt;br&gt;&amp;nbsp;&amp;gt; interval somewhere to avoid this. (e.g. In the JDBC url. Somthing like
&lt;br&gt;&amp;nbsp;&amp;gt; loginTimout?)
&lt;br&gt;&lt;br&gt;Try &amp;quot;socketTimeout&amp;quot; parameter, if you can use the current version
&lt;br&gt;(8.4 Build 701) of the driver.
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://jdbc.postgresql.org/documentation/84/connect.html#connection-parameters&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jdbc.postgresql.org/documentation/84/connect.html#connection-parameters&lt;/a&gt;&lt;br&gt;&lt;br&gt;Regards,
&lt;br&gt;Sadanori
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26303952&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Read-Timeout-tp26301655p26303952.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26301655</id>
	<title>Read Timeout</title>
	<published>2009-11-11T05:48:55Z</published>
	<updated>2009-11-11T05:48:55Z</updated>
	<author>
		<name>Michael Mangeng-2</name>
	</author>
	<content type="html">Hello all!
&lt;br&gt;&lt;br&gt;I've got an issue with the call to preparedStatement.executeBatch. The &amp;nbsp;
&lt;br&gt;performing thread is locked in a productive system for some hours in &amp;nbsp;
&lt;br&gt;SocketInputStream.read, as you can see in the stacktrace below. The &amp;nbsp;
&lt;br&gt;database server is currently reachable but it's possible that it had &amp;nbsp;
&lt;br&gt;been off for a few seconds (we're logging over the internet connection &amp;nbsp;
&lt;br&gt;to another building).
&lt;br&gt;&lt;br&gt;My question is weather there is a possibility to define a read timeout &amp;nbsp;
&lt;br&gt;interval somewhere to avoid this. (e.g. In the JDBC url. Somthing like &amp;nbsp;
&lt;br&gt;loginTimout?)
&lt;br&gt;&lt;br&gt;Stacktrace is below.
&lt;br&gt;&lt;br&gt;Thanks a lot and greetings,
&lt;br&gt;Michael
&lt;br&gt;&lt;br&gt;&amp;nbsp; java.net.SocketInputStream.socketRead0(null:-2)
&lt;br&gt;&amp;nbsp; java.net.SocketInputStream.read(null:-1)
&lt;br&gt;&amp;nbsp; org.postgresql.core.VisibleBufferedInputStream.readMore 
&lt;br&gt;(VisibleBufferedInputStream.java:135)
&lt;br&gt;&amp;nbsp; org.postgresql.core.VisibleBufferedInputStream.ensureBytes 
&lt;br&gt;(VisibleBufferedInputStream.java:104)
&lt;br&gt;&amp;nbsp; org.postgresql.core.VisibleBufferedInputStream.read 
&lt;br&gt;(VisibleBufferedInputStream.java:73)
&lt;br&gt;&amp;nbsp; org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)
&lt;br&gt;&amp;nbsp; org.postgresql.core.v3.QueryExecutorImpl.processResults 
&lt;br&gt;(QueryExecutorImpl.java:1166)
&lt;br&gt;&amp;nbsp; org.postgresql.core.v3.QueryExecutorImpl.execute 
&lt;br&gt;(QueryExecutorImpl.java:351)
&lt;br&gt;&amp;nbsp; org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch 
&lt;br&gt;(AbstractJdbc2Statement.java:2674)
&lt;br&gt;&amp;nbsp; org.apache.commons.dbcp.DelegatingStatement.executeBatch 
&lt;br&gt;(DelegatingStatement.java:297)
&lt;br&gt;&amp;nbsp; &amp;nbsp;
&lt;br&gt;com.v8tech.pneuma.eventlogger.internal.NodeprocessingDataEntriesoggerImpl.commitBatch 
&lt;br&gt;(NodeEventLoggerImpl.java:462)
&lt;br&gt;&amp;nbsp; &amp;nbsp;
&lt;br&gt;com.v8tech.pneuma.eventlogger.internal.NodeEventLoggerImpl.processDataEntries 
&lt;br&gt;(NodeEventLoggerImpl.java:378)
&lt;br&gt;&amp;nbsp; com.v8tech.pneuma.eventlogger.internal.NodeEventLoggerImpl.tick 
&lt;br&gt;(NodeEventLoggerImpl.java:502)
&lt;br&gt;&amp;nbsp; com.v8tech.components.ticker.Ticker$TickerRunnable$1.run(Ticker.java: 
&lt;br&gt;206)
&lt;br&gt;&amp;nbsp; java.util.concurrent.ThreadPoolExecutor$Worker.runTask(null:-1)
&lt;br&gt;&amp;nbsp; java.util.concurrent.ThreadPoolExecutor$Worker.run(null:-1)
&lt;br&gt;&amp;nbsp; java.lang.Thread.run(null:-1)
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26301655&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Read-Timeout-tp26301655p26301655.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26215774</id>
	<title>Database connection error, try to reset the connection parameters</title>
	<published>2009-11-05T07:50:03Z</published>
	<updated>2009-11-05T07:50:03Z</updated>
	<author>
		<name>cholid</name>
	</author>
	<content type="html">Hi all,
&lt;br&gt;im newbie in here
&lt;br&gt;when im login to some application that connection to postgres
&lt;br&gt;this message show
&lt;br&gt;&amp;quot;Database connection error, try to reset the connection parameters&amp;quot;
&lt;br&gt;any one can help me?
&lt;br&gt;thanks regards
&lt;br&gt;cholid.r</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Database-connection-error%2C-try-to-reset-the-connection-parameters-tp26215774p26215774.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26205972</id>
	<title>Re: commit and rollback don't throw exceptions when	 they should</title>
	<published>2009-11-04T14:40:17Z</published>
	<updated>2009-11-04T14:40:17Z</updated>
	<author>
		<name>Kevin Grittner</name>
	</author>
	<content type="html">taktos &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26205972&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;taktos@...&lt;/a&gt;&amp;gt; wrote: 
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;gt; Drivers other than PosrgreSQL throws exception as I had expected,
&lt;br&gt;&amp;gt; but PostgreSQL didn't throw exception.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Having received no feedback on the preliminary patch I previously
&lt;br&gt;posted, I'll suggest this (fairly minimal) patch. &amp;nbsp;I didn't attempt to
&lt;br&gt;deal with the distributed transaction issue, since it seemed pretty
&lt;br&gt;messy and I wasn't sure the fix was worth the mess it would make. &amp;nbsp;As
&lt;br&gt;far as I can see, it should fix the OP's problem, although it would be
&lt;br&gt;nice to get a confirmation of that.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;This patch is basically the same as the previous one, except that I've
&lt;br&gt;updated the javadocs to match the new behavior.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;If there are any issues with this, I can have another go at it.
&lt;br&gt;&amp;nbsp;
&lt;br&gt;-Kevin
&lt;br&gt;&lt;br&gt;&lt;br /&gt;Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java
&lt;br&gt;===================================================================
&lt;br&gt;RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v
&lt;br&gt;retrieving revision 1.52
&lt;br&gt;diff -c -r1.52 AbstractJdbc2Connection.java
&lt;br&gt;*** org/postgresql/jdbc2/AbstractJdbc2Connection.java	1 Jul 2009 05:00:40 -0000	1.52
&lt;br&gt;--- org/postgresql/jdbc2/AbstractJdbc2Connection.java	4 Nov 2009 22:28:59 -0000
&lt;br&gt;***************
&lt;br&gt;*** 676,691 ****
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* The method commit() makes all changes made since the previous
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* commit/rollback permanent and releases any database locks currently
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* held by the Connection. This method should only be used when
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* auto-commit has been disabled. &amp;nbsp;(If autoCommit == true, then we
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* just return anyhow)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* @exception SQLException if a database access error occurs
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* @see setAutoCommit
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; public void commit() throws SQLException
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (autoCommit)
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executeTransactionCommand(commitQuery);
&lt;br&gt;--- 676,697 ----
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* The method commit() makes all changes made since the previous
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* commit/rollback permanent and releases any database locks currently
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* held by the Connection. This method should only be used when
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* auto-commit has been disabled.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* @exception SQLException if a database access error occurs,
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this method &amp;nbsp;is called on a closed connection or
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this Connection object is in auto-commit mode
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* @see setAutoCommit
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; public void commit() throws SQLException
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (isClosed())
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;Cannot commit when connection is closed.&amp;quot;),
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PSQLState.CONNECTION_FAILURE);
&lt;br&gt;+ 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (autoCommit)
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;Cannot commit when autoCommit is enabled.&amp;quot;),
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PSQLState.NO_ACTIVE_SQL_TRANSACTION);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executeTransactionCommand(commitQuery);
&lt;br&gt;***************
&lt;br&gt;*** 696,708 ****
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* commit/rollback and releases any database locks currently held by
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* the Connection.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* @exception SQLException if a database access error occurs
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* @see commit
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; public void rollback() throws SQLException
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (autoCommit)
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ;
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executeTransactionCommand(rollbackQuery);
&lt;br&gt;--- 702,721 ----
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* commit/rollback and releases any database locks currently held by
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* the Connection.
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* @exception SQLException if a database access error occurs,
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this method &amp;nbsp;is called on a closed connection or
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this Connection object is in auto-commit mode
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* @see commit
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; public void rollback() throws SQLException
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (isClosed())
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;Cannot rollback when connection is closed.&amp;quot;),
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PSQLState.CONNECTION_FAILURE);
&lt;br&gt;+ 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (autoCommit)
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new PSQLException(GT.tr(&amp;quot;Cannot rollback when autoCommit is enabled.&amp;quot;),
&lt;br&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PSQLState.NO_ACTIVE_SQL_TRANSACTION);
&lt;br&gt;&amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (protoConnection.getTransactionState() != ProtocolConnection.TRANSACTION_IDLE)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; executeTransactionCommand(rollbackQuery);
&lt;br&gt;&lt;br /&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26205972&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/commit-and-rollback-don%27t-throw-exceptions-when-they-should-tp25981287p26205972.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26184452</id>
	<title>Re: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't  get list of databases with \list</title>
	<published>2009-11-03T10:39:54Z</published>
	<updated>2009-11-03T10:39:54Z</updated>
	<author>
		<name>Richard Broersma</name>
	</author>
	<content type="html">On Tue, Nov 3, 2009 at 10:29 AM, Michael Wood &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184452&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;esiotrot@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; What does it do when you have multiple schemas (schemata?) in the database?
&lt;br&gt;&lt;br&gt;It returns a ResultSet listing all of the schemas:
&lt;br&gt;&lt;br&gt;Where is what I get when I tested it:
&lt;br&gt;&lt;br&gt;a
&lt;br&gt;b
&lt;br&gt;c
&lt;br&gt;information_schema
&lt;br&gt;pg_catalog
&lt;br&gt;pg_toast_temp_1
&lt;br&gt;public
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Regards,
&lt;br&gt;Richard Broersma Jr.
&lt;br&gt;&lt;br&gt;Visit the Los Angeles PostgreSQL Users Group (LAPUG)
&lt;br&gt;&lt;a href=&quot;http://pugs.postgresql.org/lapug&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pugs.postgresql.org/lapug&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184452&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug---DatabaseMetaData.getCatalogs%28%29-was--Novice--Can%27t-get-list-of--databases-with-%5Clist-tp26183463p26184452.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26184281</id>
	<title>Re: [NOVICE] Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't  get list of databases with \list</title>
	<published>2009-11-03T10:29:08Z</published>
	<updated>2009-11-03T10:29:08Z</updated>
	<author>
		<name>Michael Wood-8</name>
	</author>
	<content type="html">2009/11/3 Richard Broersma &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184281&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;richard.broersma@...&lt;/a&gt;&amp;gt;:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Mon, Nov 2, 2009 at 1:05 PM, Christopher Frank &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184281&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;c.frank@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; As for JDBC, there may be something that gives equivalent information,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; but I
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;gt; couldn't find it.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; getCatalogs()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I had tried that but it only returned one database, the database to which I
&lt;br&gt;&amp;gt;&amp;gt; was already connected. There should have been 3 others.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I verified that the DatabaseMetaData.getCatalogs() only returns a
&lt;br&gt;&amp;gt; ResultSet with the currently connect database rather than all of the
&lt;br&gt;&amp;gt; databases in the PostgreSQL cluster.
&lt;/div&gt;&lt;br&gt;What does it do when you have multiple schemas (schemata?) in the database?
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Michael Wood &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184281&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;esiotrot@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184281&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug---DatabaseMetaData.getCatalogs%28%29-was--Novice--Can%27t-get-list-of--databases-with-%5Clist-tp26183463p26184281.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26184173</id>
	<title>Re: Help with prepared statment for crosstab</title>
	<published>2009-11-03T10:21:50Z</published>
	<updated>2009-11-03T10:21:50Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Tue, 3 Nov 2009, Carl Shelbourne wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; The SQL shown below works if I do not have any parameters, but when I add
&lt;br&gt;&amp;gt; the parameters, I get:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Caused by: org.postgresql.util.PSQLException: The column index is out of ra
&lt;br&gt;&amp;gt; nge: 1, number of columns: 0. 
&lt;br&gt;&lt;br&gt;The ? parameters you've used are inside a string literal, so they are not 
&lt;br&gt;considered parameters. &amp;nbsp;Consider:
&lt;br&gt;&lt;br&gt;SELECT 'Does this work?';
&lt;br&gt;&lt;br&gt;The question mark is part of the literal, not a parameter.
&lt;br&gt;&lt;br&gt;Kris Jurka
&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184173&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-with-prepared-statment-for-crosstab-tp26183798p26184173.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26184092</id>
	<title>Re: Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of  databases with \list</title>
	<published>2009-11-03T10:16:15Z</published>
	<updated>2009-11-03T10:16:15Z</updated>
	<author>
		<name>Kris Jurka</name>
	</author>
	<content type="html">&lt;br&gt;&lt;br&gt;On Tue, 3 Nov 2009, Richard Broersma wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; I verified that the DatabaseMetaData.getCatalogs() only returns a
&lt;br&gt;&amp;gt; ResultSet with the currently connect database rather than all of the
&lt;br&gt;&amp;gt; databases in the PostgreSQL cluster.
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;The previous discussion to refer to is probably:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://archives.postgresql.org/pgsql-jdbc/2004-01/msg00164.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://archives.postgresql.org/pgsql-jdbc/2004-01/msg00164.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;Crippling getCatalogs was the best proposed solution to the fact that no 
&lt;br&gt;other catalog based functionality existed (or could).
&lt;br&gt;&lt;br&gt;Kris Jurka
&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26184092&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug---DatabaseMetaData.getCatalogs%28%29-was--Novice--Can%27t-get-list-of--databases-with-%5Clist-tp26183463p26184092.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26183463</id>
	<title>Bug - DatabaseMetaData.getCatalogs() was [Novice] Can't get list of  databases with \list</title>
	<published>2009-11-03T09:36:56Z</published>
	<updated>2009-11-03T09:36:56Z</updated>
	<author>
		<name>Richard Broersma</name>
	</author>
	<content type="html">On Mon, Nov 2, 2009 at 1:05 PM, Christopher Frank &amp;lt;&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26183463&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;c.frank@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; As for JDBC, there may be something that gives equivalent information,
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; but I
&lt;br&gt;&amp;gt;&amp;gt; &amp;gt; couldn't find it.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; getCatalogs()
&lt;br&gt;&lt;br&gt;&amp;gt; I had tried that but it only returned one database, the database to which I
&lt;br&gt;&amp;gt; was already connected. There should have been 3 others.
&lt;br&gt;&lt;br&gt;I verified that the DatabaseMetaData.getCatalogs() only returns a
&lt;br&gt;ResultSet with the currently connect database rather than all of the
&lt;br&gt;databases in the PostgreSQL cluster.
&lt;br&gt;&lt;br&gt;I see there was a previous discussion on this topic, stating that
&lt;br&gt;Databases and Catalogs are not the same, so only returning the
&lt;br&gt;currently connected database is correct:
&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://archives.postgresql.org/pgsql-jdbc/2007-02/msg00112.php&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://archives.postgresql.org/pgsql-jdbc/2007-02/msg00112.php&lt;/a&gt;&lt;br&gt;&lt;br&gt;However, calling the DatabaseMetaData.getCatalogTerm() function states
&lt;br&gt;that the PostgreSQL's equivalent to a Catalog is a &amp;quot;database&amp;quot;. &amp;nbsp;For
&lt;br&gt;this reason, it seems reasonable to me that getCatalogs() should
&lt;br&gt;return a listing off all PostgreSQL databases.
&lt;br&gt;&lt;br&gt;If one really only wants the currently connected database,
&lt;br&gt;Connection.getCatalog() will suffice.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Regards,
&lt;br&gt;Richard Broersma Jr.
&lt;br&gt;&lt;br&gt;Visit the Los Angeles PostgreSQL Users Group (LAPUG)
&lt;br&gt;&lt;a href=&quot;http://pugs.postgresql.org/lapug&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://pugs.postgresql.org/lapug&lt;/a&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26183463&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Bug---DatabaseMetaData.getCatalogs%28%29-was--Novice--Can%27t-get-list-of--databases-with-%5Clist-tp26183463p26183463.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26183798</id>
	<title>Help with prepared statment for crosstab</title>
	<published>2009-11-03T05:15:21Z</published>
	<updated>2009-11-03T05:15:21Z</updated>
	<author>
		<name>Carl Shelbourne-2</name>
	</author>
	<content type="html">&lt;html xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot; xmlns:o=&quot;urn:schemas-microsoft-com:office:office&quot; xmlns:w=&quot;urn:schemas-microsoft-com:office:word&quot; xmlns=&quot;http://www.w3.org/TR/REC-html40&quot;&gt;

&lt;head&gt;
&lt;META http-equiv=Content-Type content=&quot;text/html; charset=ISO-8859-1&quot;&gt;
&lt;meta name=Generator content=&quot;Microsoft Word 11 (filtered medium)&quot;&gt;

&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapedefaults v:ext=&quot;edit&quot; spidmax=&quot;1027&quot; /&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:shapelayout v:ext=&quot;edit&quot;&gt;
  &lt;o:idmap v:ext=&quot;edit&quot; data=&quot;1&quot; /&gt;
 &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;
&lt;/head&gt;

&lt;body lang=EN-US link=blue vlink=purple&gt;

&lt;div class=Section1&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;Hi.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;I have been asked to produce a report for a new game. The
report needs to show the gamers unique id, gamer_number, his nickname, the
average score of the best 5 scores he got playing the game during a specified
period and a list of the top five scores that made this average.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;e.g.:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;gamerNumber;nickname;average;score1;score2;score3;score4;score5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;91692656912;&amp;quot;nickname1&amp;quot;;&amp;quot;14.33&amp;quot;;29.85;21.03;7.38;6.73;6.66&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;The SQL shown below works if I do not have any parameters,
but when I add the parameters, I get:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Courier New&quot;&gt;&lt;span style='font-size:12.0pt;
font-family:&quot;Courier New&quot;'&gt;Caused&amp;nbsp;by:&amp;nbsp;org.postgresql.util.PSQLException:&amp;nbsp;The&amp;nbsp;column&amp;nbsp;index&amp;nbsp;is&amp;nbsp;out&amp;nbsp;of&amp;nbsp;range:&amp;nbsp;1,&amp;nbsp;number&amp;nbsp;of&amp;nbsp;columns:&amp;nbsp;0.&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;org.postgresql.core.v3.SimpleParameterList.bind(SimpleParameterList.java:53)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;org.postgresql.core.v3.SimpleParameterList.setStringParameter(SimpleParameterList.java:118)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2155)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;org.postgresql.jdbc2.AbstractJdbc2Statement.setTimestamp(AbstractJdbc2Statement.java:3114)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;org.postgresql.jdbc2.AbstractJdbc2Statement.setTimestamp(AbstractJdbc2Statement.java:1358)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:420)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.setStatementParameter(JRJdbcQueryExecuter.java:255)&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;at&amp;nbsp;net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createStatement(JRJdbcQueryExecuter.java:230)&amp;nbsp;&lt;/span&gt;&lt;/font&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;I am not too sure if this is possible, but I am trying to
prepare a statement containing a crosstab:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Courier New&quot;&gt;&lt;span style='font-size:12.0pt;
font-family:&quot;Courier New&quot;'&gt;SELECT&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gamehighscore.row_name[1]&amp;nbsp;as&amp;nbsp;gamer_number,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gamehighscore.row_name[2]&amp;nbsp;as&amp;nbsp;nick_name,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;gamehighscore.row_name[3]&amp;nbsp;as&amp;nbsp;average_score,&amp;nbsp;score1,&amp;nbsp;score2,&amp;nbsp;score3,&amp;nbsp;score4,&amp;nbsp;score5&amp;nbsp;from&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;crosstab('SELECT&amp;nbsp;ARRAY[g.gamer_number::text,&amp;nbsp;pl.nick_name,&amp;nbsp;(SELECT&amp;nbsp;avg(tp.high_score)&amp;nbsp;as&amp;nbsp;myAvg&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;from&amp;nbsp;(select&amp;nbsp;score&amp;nbsp;as&amp;nbsp;top_score&amp;nbsp;from&amp;nbsp;game_score&amp;nbsp;t2&amp;nbsp;WHERE&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; game_date&amp;nbsp;BETWEEN&amp;nbsp;?&amp;nbsp;AND&amp;nbsp;?&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;and&amp;nbsp;g.gamer_number=t2.gamer_number&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;order&amp;nbsp;by&amp;nbsp;score&amp;nbsp;desc&amp;nbsp;limit&amp;nbsp;5)&amp;nbsp;as&amp;nbsp;tp)::text]&amp;nbsp;as&amp;nbsp;row_name,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;score::text&amp;nbsp;as&amp;nbsp;bucket,&amp;nbsp;score&amp;nbsp;from&amp;nbsp;bet&amp;nbsp;b&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Courier New&quot;&gt;&lt;span style='font-size:12.0pt;
font-family:&quot;Courier New&quot;'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
left&amp;nbsp;join&amp;nbsp;player&amp;nbsp;pl&amp;nbsp;on&amp;nbsp;g.gamer_number=pl.gamer_number&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WHERE&amp;nbsp;g.game_date&amp;nbsp;BETWEEN&amp;nbsp;?&amp;nbsp;AND&amp;nbsp;?&amp;nbsp;AND&amp;nbsp;g.gamer_number=?&amp;nbsp;order&amp;nbsp;by&amp;nbsp;score&amp;nbsp;DESC&amp;nbsp;limit&amp;nbsp;5')&lt;br&gt;
as&amp;nbsp;gamehighscore (&amp;nbsp;row_name&amp;nbsp;text[],&amp;nbsp;score1&amp;nbsp;numeric,&amp;nbsp;score2&amp;nbsp;numeric&amp;nbsp;,&amp;nbsp;score3&amp;nbsp;numeric&amp;nbsp;,&amp;nbsp;score4&amp;nbsp;numeric&amp;nbsp;,&amp;nbsp;score5&amp;nbsp;numeric&amp;nbsp;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Courier New&quot;&gt;&lt;span style='font-size:12.0pt;
font-family:&quot;Courier New&quot;'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Courier New&quot;&gt;&lt;span style='font-size:12.0pt;
font-family:&quot;Courier New&quot;'&gt;Running against Postgres 8.3.8 running on Windows
XP. Tried with jdbc drivers &lt;/span&gt;&lt;/font&gt;8.3-603.jdbc3 and 8.4-701.jdbc3&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Is this possible? How do I escape the parameters within the crosstab?
Is it the crosstab that is the issue even? Any help would be most welcome.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=3 face=&quot;Times New Roman&quot;&gt;&lt;span style='font-size:
12.0pt'&gt;Carl&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;
font-family:Arial'&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;

&lt;/div&gt;


&lt;p align=&quot;left&quot;&gt;&lt;font color=&quot;#333333&quot;&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;This email and its attachments are intended for the above named only and may be confidential. &lt;/font&gt;&lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot; size=&quot;2&quot;&gt;If you have received them in error please notify the sender immediately and delete all records &lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;of the email and its attachments from your computer. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#333333&quot;&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;Unless you are the intended recipient you must not read, copy, distribute, &lt;/font&gt;&lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;use or retain this email or any attachments or any part of them. &lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color=&quot;#333333&quot;&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;Although we aim to use efficient virus checking procedures for emails and a&lt;/font&gt;&lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;ttachments we accept no liability for viruses and it is the recipient's &lt;/font&gt;&lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;responsibility to ensure they are actually virus free.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr /&gt;&lt;p /&gt;&lt;p align=&quot;left&quot; class=&quot;MsoPlainText&quot;&gt;&lt;font color=&quot;#333333&quot;&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;Stanley International Betting  |  201 - 210 Mercury Court |  Tithebarn Street  |  Liverpool  |  L2 2QP  |  +44 151 235 2000  |  &lt;/font&gt;&lt;/font&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;Registered in England with no.3357517&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;p align=&quot;left&quot; class=&quot;MsoPlainText&quot;&gt;&lt;font color=&quot;#333333&quot;&gt;&lt;font face=&quot;arial,helvetica,sans-serif&quot;&gt;&lt;font size=&quot;2&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;/body&gt;

&lt;/html&gt;
</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Help-with-prepared-statment-for-crosstab-tp26183798p26183798.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26134131</id>
	<title>Re: Implementation of query timeout</title>
	<published>2009-10-30T10:35:25Z</published>
	<updated>2009-10-30T10:35:25Z</updated>
	<author>
		<name>Radosław Smogura-4</name>
	</author>
	<content type="html">Dnia piątek 30 październik 2009 o 08:47:02 napisałeś:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Radoslaw Smogura wrote:
&lt;br&gt;&amp;gt; &amp;gt; I read a TODO list, and I decided to help a bit. So I've tried to
&lt;br&gt;&amp;gt; &amp;gt; implement queryTimeout, currently ony for non-batch statements. You can
&lt;br&gt;&amp;gt; &amp;gt; see code, at &lt;a href=&quot;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;gt; and analyze, chceck and test it.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; Small description how it works.
&lt;br&gt;&amp;gt; &amp;gt;
&lt;br&gt;&amp;gt; &amp;gt; 1. When the query is executed it checks if timeout &amp;gt; 0.
&lt;br&gt;&amp;gt; &amp;gt; 2. If yes it creates TimerTask and add it to the queue, then sends the
&lt;br&gt;&amp;gt; &amp;gt; query to server.
&lt;br&gt;&amp;gt; &amp;gt; 3. On timeout and if statement hasn't ended cancelStatement is called().
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Maybe I am missing something there, but wouldn't it be much easier
&lt;br&gt;&amp;gt; to send the following to the server:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; SET statement_timeout=&amp;lt;n&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Then all statements that time out throw an exception with SQLSTATE 57014,
&lt;br&gt;&amp;gt; and there's no need for separate threads and canceling the query.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Yours,
&lt;br&gt;&amp;gt; Lauernz Albe
&lt;br&gt;&amp;gt; 
&lt;/div&gt;Hello,
&lt;br&gt;SET statement_timeout only set timeout for statement processing on server, it 
&lt;br&gt;not include the time of transfering data, which can be long for BLOBs. I've 
&lt;br&gt;found few posts that this is not enaugh solution &amp;quot;SET statement_timeout&amp;quot; from 
&lt;br&gt;above reasons. It's way those timeout is implemented in JDBC side.
&lt;br&gt;&lt;br&gt;Kind regards,
&lt;br&gt;Radek Smogura.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26134131&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Implementation-of-query-timeout-tp26114018p26134131.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26126122</id>
	<title>Re: Implementation of query timeout</title>
	<published>2009-10-30T00:47:02Z</published>
	<updated>2009-10-30T00:47:02Z</updated>
	<author>
		<name>Albe Laurenz *EXTERN*</name>
	</author>
	<content type="html">Radoslaw Smogura wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; I read a TODO list, and I decided to help a bit. So I've tried to implement 
&lt;br&gt;&amp;gt; queryTimeout, currently ony for non-batch statements. You can see code, at
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&lt;/a&gt;&lt;br&gt;&amp;gt; and analyze, chceck and test it.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Small description how it works.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 1. When the query is executed it checks if timeout &amp;gt; 0.
&lt;br&gt;&amp;gt; 2. If yes it creates TimerTask and add it to the queue, then sends the query 
&lt;br&gt;&amp;gt; to server.
&lt;br&gt;&amp;gt; 3. On timeout and if statement hasn't ended cancelStatement is called().
&lt;/div&gt;&lt;br&gt;Maybe I am missing something there, but wouldn't it be much easier
&lt;br&gt;to send the following to the server:
&lt;br&gt;&lt;br&gt;SET statement_timeout=&amp;lt;n&amp;gt;
&lt;br&gt;&lt;br&gt;Then all statements that time out throw an exception with SQLSTATE 57014,
&lt;br&gt;and there's no need for separate threads and canceling the query.
&lt;br&gt;&lt;br&gt;Yours,
&lt;br&gt;Lauernz Albe
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26126122&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Implementation-of-query-timeout-tp26114018p26126122.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26120014</id>
	<title>Howto retrieve a custom type via JDBC</title>
	<published>2009-10-29T13:11:56Z</published>
	<updated>2009-10-29T13:11:56Z</updated>
	<author>
		<name>Viktor Rosenfeld-3</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;I've created a custom datatype that I would like to retrieve via JDBC.
&lt;br&gt;To make the problem more fun, the values are aggregated into an array.
&lt;br&gt;&lt;br&gt;The type definition is:
&lt;br&gt;&lt;br&gt;&amp;nbsp; CREATE TYPE annotation AS ( namespace varchar, name varchar, value varchar );
&lt;br&gt;&lt;br&gt;The query looks something like this:
&lt;br&gt;&lt;br&gt;&amp;nbsp; SELECT 
&lt;br&gt;&amp;nbsp; &amp;nbsp; node_ref AS id, 
&lt;br&gt;&amp;nbsp; &amp;nbsp; array_agg(DISTINCT ROW(namespace, name, value)::annotation) AS annotation
&lt;br&gt;&amp;nbsp; ...
&lt;br&gt;&amp;nbsp; GROUP BY id;
&lt;br&gt;&lt;br&gt;I've hacked together some experimental code:
&lt;br&gt;&lt;br&gt;&amp;nbsp; Array array = rs.getArray(2);
&lt;br&gt;&amp;nbsp; if (array != null) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; ResultSet arrayRs = array.getResultSet();
&lt;br&gt;&amp;nbsp; &amp;nbsp; while (arrayRs.next()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PGobject anno = (PGobject) arrayRs.getObject(&amp;quot;value&amp;quot;);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // anno.getValue() returns the String &amp;quot;(namespace,name,value)&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; PGtokenizer t = new PGtokenizer(PGtokenizer.remove(anno.getValue(), &amp;quot;(&amp;quot;, &amp;quot;)&amp;quot;), ',');
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (t.getSize() != 3)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new RuntimeException(&amp;quot;Could not read to annotation type: &amp;quot; + anno.getValue());
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; String namespace = t.getToken(0);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; String name = t.getToken(1);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; String value = t.getToken(2);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; Annotation annotation = new Annotation(namespace, name, value);
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;&lt;br&gt;The code above is not only fugly, but it breaks if there's a comma in
&lt;br&gt;one of those values (e.g. (tiger,lemma,&amp;quot;1,62&amp;quot;)). &amp;nbsp;In this case, they are
&lt;br&gt;4 tokens. &amp;nbsp;BTW, the quotes around 1,62 are inserted by PostgreSQL,
&lt;br&gt;they're not actually there in database. &amp;nbsp;If PostgreSQL is smart enough
&lt;br&gt;to insert the quotes, it should be able to correctly parse the string,
&lt;br&gt;shouldn't it?
&lt;br&gt;&lt;br&gt;I got the idea to use PGtokenizer from looking at PGbox and stuff. &amp;nbsp;But
&lt;br&gt;my reason to create a custom type in the first place was to get to its
&lt;br&gt;constituents in a clean way. &amp;nbsp;Previously, I had simply concatenated the
&lt;br&gt;strings with &amp;quot;:&amp;quot; and &amp;quot;=&amp;quot; in SQL and splitted them back into the
&lt;br&gt;components in my Java code.
&lt;br&gt;&lt;br&gt;So, the question is: How to cleanly retrieve the components of a custom
&lt;br&gt;datatype using JDBC?
&lt;br&gt;&lt;br&gt;Cheers,
&lt;br&gt;Viktor
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26120014&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Howto-retrieve-a-custom-type-via-JDBC-tp26120014p26120014.html" />
</entry>

<entry>
	<id>tag:old.nabble.com,2006:post-26114018</id>
	<title>Implementation of query timeout</title>
	<published>2009-10-29T07:19:58Z</published>
	<updated>2009-10-29T07:19:58Z</updated>
	<author>
		<name>Radosław Smogura-4</name>
	</author>
	<content type="html">Hello,
&lt;br&gt;&lt;br&gt;I send this message again, because there were problems with my email address, 
&lt;br&gt;so it didn't reach mailinglist.
&lt;br&gt;&lt;br&gt;I read a TODO list, and I decided to help a bit. So I've tried to implement 
&lt;br&gt;queryTimeout, currently ony for non-batch statements. You can see code, at
&lt;br&gt;&lt;a href=&quot;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://rsmogura.net/pgsql/pgsql_jdbc_querytimeout.tar.bz2&lt;/a&gt;&lt;br&gt;and analyze, chceck and test it.
&lt;br&gt;&lt;br&gt;Small description how it works.
&lt;br&gt;&lt;br&gt;1. When the query is executed it checks if timeout &amp;gt; 0.
&lt;br&gt;2. If yes it creates TimerTask and add it to the queue, then sends the query 
&lt;br&gt;to server.
&lt;br&gt;3. On timeout and if statement hasn't ended cancelStatement is called().
&lt;br&gt;&lt;br&gt;I've used Timer to don't create multiple threads with each statement. The 
&lt;br&gt;AbstractJdbc2 have setQueryTimeout method, so DataSources and 
&lt;br&gt;PolledConnections can utilze it to set Timer shared for all connections.
&lt;br&gt;&lt;br&gt;The QueryExecutor has new method executeSynchronized (description in API). To 
&lt;br&gt;prevent termination on next statement &amp; run statements in current thread, the 
&lt;br&gt;lock on QueryExecutor is needed (so no other thread will send other query 
&lt;br&gt;until cancelStatement is fully called). This method can be more usefull then 
&lt;br&gt;synchronized(...) block and can be used later.
&lt;br&gt;&lt;br&gt;Some new utilities class has been added.
&lt;br&gt;&lt;br&gt;The test code creates non tempolary tables to simulate long-run by creating 
&lt;br&gt;data lock on two transactions.
&lt;br&gt;&lt;br&gt;If the JDBC will go to Java 5, some of this code can use new 
&lt;br&gt;java.util.concurent API.
&lt;br&gt;&lt;br&gt;Kind regards,
&lt;br&gt;Radek Smogura
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Sent via pgsql-jdbc mailing list (&lt;a href=&quot;http://old.nabble.com/user/SendEmail.jtp?type=post&amp;post=26114018&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;pgsql-jdbc@...&lt;/a&gt;)
&lt;br&gt;To make changes to your subscription:
&lt;br&gt;&lt;a href=&quot;http://www.postgresql.org/mailpref/pgsql-jdbc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.postgresql.org/mailpref/pgsql-jdbc&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://old.nabble.com/Implementation-of-query-timeout-tp26114018p26114018.html" />
</entry>

</feed>
