Question about running "Vacuum" through JDBC

Started by Ying Lualmost 21 years ago3 messagesgeneral
Jump to latest
#1Ying Lu
ying_lu@cs.concordia.ca

Greetings,

I tried to "Vacuum table" through JDBC. I got the following errors:

ERROR: VACUUM cannot run inside a transaction block

Does it mean I should only run vacuum through the command line such as
"psql> vacuum TableName "?

Thanks a lot,
Emi

#2Brad Nicholson
bnichols@ca.afilias.info
In reply to: Ying Lu (#1)
Re: Question about running "Vacuum" through JDBC

Ying Lu wrote:

Greetings,

I tried to "Vacuum table" through JDBC. I got the following errors:

ERROR: VACUUM cannot run inside a transaction block

Does it mean I should only run vacuum through the command line such as
"psql> vacuum TableName "?

Nope, it means exactly what the error says. You are trying to run vacum
inside a transaction, which can't be done. JDBC is likely opening a
transaction for you automatically. Stop it from doing this, and you
should be able to vacuum.

--
Brad Nicholson 416-673-4106
Database Administrator, Afilias Canada Corp.

#3Paul Thomas
paul@tmsl.demon.co.uk
In reply to: Ying Lu (#1)
Re: Question about running "Vacuum" through JDBC

On 06/05/2005 16:22 Ying Lu wrote:

Greetings,

I tried to "Vacuum table" through JDBC. I got the following errors:

ERROR: VACUUM cannot run inside a transaction block

Does it mean I should only run vacuum through the command line such as
"psql> vacuum TableName "?

You don't say what version of the DB and JDBC driver you're using but I
have an app which does vavuums via JDBC no problem. Just make sure that
you've setAutoCommit(true).

-- 
Paul Thomas
+------------------------------+-------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for Business           |
| Computer Consultants         | http://www.thomas-micro-systems-ltd.co.uk |
+------------------------------+-------------------------------------------+