Обсуждение: JDBC, PgSQL 7.2: transactions not supported!!

Поиск
Список
Период
Сортировка

JDBC, PgSQL 7.2: transactions not supported!!

От
Zengfa Gao
Дата:
Hi,

I am using JDBC Driver to access PgSQL 7.2. When I
add:

Statement.executeQuery("BEGIN WORK;");
...
Statement.executeQuery("Insert.........");
...

Statement.executeQuery("COMMIT WORK;");

in the java code.

I got:
transactions not supported!!

According the document of 7.2, transaction is
supported. Does anyone know what's wrong here?

Thanks!

Zengfa

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: JDBC, PgSQL 7.2: transactions not supported!!

От
Barry Lind
Дата:
Zengfa,

Transactions are supported, you are just doing them incorrectly for
jdbc.  In jdbc you turn on transactions by calling
connection.setAutoCommit(false);
and you commit or rollback by calling connection.commit(); or
connection.rollback();

--Barry

Zengfa Gao wrote:
> Hi,
>
> I am using JDBC Driver to access PgSQL 7.2. When I
> add:
>
> Statement.executeQuery("BEGIN WORK;");
> ...
> Statement.executeQuery("Insert.........");
> ...
>
> Statement.executeQuery("COMMIT WORK;");
>
> in the java code.
>
> I got:
> transactions not supported!!
>
> According the document of 7.2, transaction is
> supported. Does anyone know what's wrong here?
>
> Thanks!
>
> Zengfa
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>