Home > Archive > PostgreSQL JDBC > September 2005 > Getting vacuum results









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Getting vacuum results
Joseph Shraibman

2005-09-02, 3:25 am

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

2005-09-13, 8:24 pm


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Joseph Shraibman

2005-09-13, 8:24 pm

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:
>
>
> 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();
> }
> }
>
>


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Kris Jurka

2005-09-13, 8:24 pm



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


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Joseph Shraibman

2005-09-13, 8:24 pm

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(Driver
Manager.java:525)
at java.sql.DriverManager. getConnection(Driver
Manager.java:171)
at <snip>
Caused by: java.security. AccessControlExcepti
on: access denied
(java.sql.SQLPermission setLog)
at
java.security. AccessControlContext
. checkPermission(Acce
ssControlContext.java:264)
at
java.security.AccessController. checkPermission(Acce
ssController.java:427)
at
java.lang.SecurityManager. checkPermission(Secu
rityManager.java:532)
at java.sql.DriverManager. setLogWriter(DriverM
anager.java:109)
at
org.postgresql.jdbc2. AbstractJdbc2Connect
ion. enableDriverManagerL
ogging(AbstractJdbc2
Connection.java:1086)
at
org.postgresql.jdbc2. AbstractJdbc2Connect
ion.<init> (AbstractJdbc2Connec
tion.java:98)
at
org.postgresql.jdbc3. AbstractJdbc3Connect
ion.<init> (AbstractJdbc3Connec
tion.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:
>
>
> What's the stacktrace coming from this?
>
> Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Joseph Shraibman

2005-09-13, 8:24 pm

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:
>
>
> What's the stacktrace coming from this?
>
> Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Kris Jurka

2005-09-14, 3:23 am



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. AbstractJdbc2Stateme
nt. executeQuery(Abstrac
tJdbc2Statement.java:232)
at Vacuum.main(Vacuum.java:9)

and this is the result that I would expect.

Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com