pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Getting vacuum results
7+ messages / 2 participants
[nested] [flat]

* Getting vacuum results
@ 2005-09-02 03:38 Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Joseph Shraibman @ 2005-09-02 03:38 UTC (permalink / raw)
  To: pgsql-jdbc

If I run VACUUM VERBOSE from jdbc, how do I get the output?  There are 
no SQLWarnings attached to the resultset.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
@ 2005-09-13 22:21 ` Kris Jurka <books@ejurka.com>
  2005-09-13 22:52   ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  0 siblings, 1 reply; 7+ messages in thread

From: Kris Jurka @ 2005-09-13 22:21 UTC (permalink / raw)
  To: Joseph Shraibman <jks@selectacast.net>; +Cc: pgsql-jdbc



On Thu, 1 Sep 2005, Joseph Shraibman wrote:

> If I run VACUUM VERBOSE from jdbc, how do I get the output?  There are no 
> SQLWarnings attached to the resultset.
>

SQLWarnings are attached to the Statement because VACUUM does not produce 
a query result.  The attached test case shows this working 
fine for me.  The one complication is that vacuum puts out 
some of its interesting information in the Detail: part of the 
log message.  The JDBC driver doesn't normally put this 
information into the warning message, so you must either 
increase the loglevel URL parameter or use the 8.1 series and 
write pg specific code to access the individual fields of the 
ServerErrorMessage class.  We plan to increase the number of fields 
used to construct the error string to include the Detail field, but 
haven't gotten around to it yet.

Kris Jurka

Attachments:

Vacuum.java (text/plain, 553B) download import java.sql.*; public class Vacuum { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/jurka?loglevel=1","jurka",""); Statement stmt = conn.createStatement(); stmt.execute("VACUUM VERBOSE"); SQLWarning warn = stmt.getWarnings(); System.out.println(warn); while (warn != null) { warn = warn.getNextWarning(); System.out.println(warn); } stmt.close(); conn.close(); } }
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
@ 2005-09-13 22:52   ` Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:55     ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Joseph Shraibman @ 2005-09-13 22:52 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

It's funny.  Your test program works, but in my server I get this:

Got SQLException: Something unusual has occured to cause the driver to 
fail. Please report this exception.

... and nothing else.

Kris Jurka wrote:
> 
> 
> On Thu, 1 Sep 2005, Joseph Shraibman wrote:
> 
>> If I run VACUUM VERBOSE from jdbc, how do I get the output?  There are 
>> no SQLWarnings attached to the resultset.
>>
> 
> SQLWarnings are attached to the Statement because VACUUM does not 
> produce a query result.  The attached test case shows this working fine 
> for me.  The one complication is that vacuum puts out some of its 
> interesting information in the Detail: part of the log message.  The 
> JDBC driver doesn't normally put this information into the warning 
> message, so you must either increase the loglevel URL parameter or use 
> the 8.1 series and write pg specific code to access the individual 
> fields of the ServerErrorMessage class.  We plan to increase the number 
> of fields used to construct the error string to include the Detail 
> field, but haven't gotten around to it yet.
> 
> Kris Jurka
> 
> 
> ------------------------------------------------------------------------
> 
> import java.sql.*;
> 
> public class Vacuum {
> 
> 	public static void main(String args[]) throws Exception {
> 		Class.forName("org.postgresql.Driver");
> 		Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/jurka?loglevel=1","jurka","");
> 		Statement stmt = conn.createStatement();
> 		stmt.execute("VACUUM VERBOSE");
> 		SQLWarning warn = stmt.getWarnings();
> 		System.out.println(warn);
> 		while (warn != null) {
> 			warn = warn.getNextWarning();
> 			System.out.println(warn);
> 		}
> 		stmt.close();
> 		conn.close();
> 	}
> }
> 
> 



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  2005-09-13 22:52   ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
@ 2005-09-13 22:55     ` Kris Jurka <books@ejurka.com>
  2005-09-14 00:49       ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-14 01:08       ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  0 siblings, 2 replies; 7+ messages in thread

From: Kris Jurka @ 2005-09-13 22:55 UTC (permalink / raw)
  To: Joseph Shraibman <jks@selectacast.net>; +Cc: pgsql-jdbc



On Tue, 13 Sep 2005, Joseph Shraibman wrote:

> It's funny.  Your test program works, but in my server I get this:
>
> Got SQLException: Something unusual has occured to cause the driver to fail. 
> Please report this exception.
>

What's the stacktrace coming from this?

Kris Jurka




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  2005-09-13 22:52   ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:55     ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
@ 2005-09-14 00:49       ` Joseph Shraibman <jks@selectacast.net>
  1 sibling, 0 replies; 7+ messages in thread

From: Joseph Shraibman @ 2005-09-14 00:49 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

Something unusual has occured to cause the driver to fail. Please report 
this exception.
org.postgresql.util.PSQLException: Something unusual has occured to 
cause the driver to fail. Please report this exception.
         at org.postgresql.Driver.connect(Driver.java:249)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at <snip>
Caused by: java.security.AccessControlException: access denied 
(java.sql.SQLPermission setLog)
         at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         at 
java.security.AccessController.checkPermission(AccessController.java:427)
         at 
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.sql.DriverManager.setLogWriter(DriverManager.java:109)
         at 
org.postgresql.jdbc2.AbstractJdbc2Connection.enableDriverManagerLogging(AbstractJdbc2Connection.java:1086)
         at 
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:98)
         at 
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
         at 
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
         at org.postgresql.Driver.connect(Driver.java:235)
         ... 7 more


Kris Jurka wrote:
> 
> 
> On Tue, 13 Sep 2005, Joseph Shraibman wrote:
> 
>> It's funny.  Your test program works, but in my server I get this:
>>
>> Got SQLException: Something unusual has occured to cause the driver to 
>> fail. Please report this exception.
>>
> 
> What's the stacktrace coming from this?
> 
> Kris Jurka



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  2005-09-13 22:52   ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:55     ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
@ 2005-09-14 01:08       ` Joseph Shraibman <jks@selectacast.net>
  2005-09-14 02:27         ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  1 sibling, 1 reply; 7+ messages in thread

From: Joseph Shraibman @ 2005-09-14 01:08 UTC (permalink / raw)
  To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-jdbc

OK from the stack trace I figured out that I had to add a permission to 
java.policy.

FYI this doesn't work:

  ResultSet rs = stmt.executeQuery("VACUUM VERBOSE profuser;");
             SQLWarning warn = rs.getWarnings();

Kris Jurka wrote:
> 
> 
> On Tue, 13 Sep 2005, Joseph Shraibman wrote:
> 
>> It's funny.  Your test program works, but in my server I get this:
>>
>> Got SQLException: Something unusual has occured to cause the driver to 
>> fail. Please report this exception.
>>
> 
> What's the stacktrace coming from this?
> 
> Kris Jurka



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Getting vacuum results
  2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:21 ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  2005-09-13 22:52   ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
  2005-09-13 22:55     ` Re: Getting vacuum results Kris Jurka <books@ejurka.com>
  2005-09-14 01:08       ` Re: Getting vacuum results Joseph Shraibman <jks@selectacast.net>
@ 2005-09-14 02:27         ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Kris Jurka @ 2005-09-14 02:27 UTC (permalink / raw)
  To: Joseph Shraibman <jks@selectacast.net>; +Cc: pgsql-jdbc



On Tue, 13 Sep 2005, Joseph Shraibman wrote:

> OK from the stack trace I figured out that I had to add a permission to 
> java.policy.
>
> FYI this doesn't work:
>
> ResultSet rs = stmt.executeQuery("VACUUM VERBOSE profuser;");
>            SQLWarning warn = rs.getWarnings();
>


With both 8.0 and 8.1dev I get:

Exception in thread "main" org.postgresql.util.PSQLException: No results 
were returned by the query.
 	at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:232)
 	at Vacuum.main(Vacuum.java:9)

and this is the result that I would expect.

Kris Jurka




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2005-09-14 02:27 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-02 03:38 Getting vacuum results Joseph Shraibman <jks@selectacast.net>
2005-09-13 22:21 ` Kris Jurka <books@ejurka.com>
2005-09-13 22:52   ` Joseph Shraibman <jks@selectacast.net>
2005-09-13 22:55     ` Kris Jurka <books@ejurka.com>
2005-09-14 00:49       ` Joseph Shraibman <jks@selectacast.net>
2005-09-14 01:08       ` Joseph Shraibman <jks@selectacast.net>
2005-09-14 02:27         ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox