Обсуждение: Is autocommit=true bad?

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

Is autocommit=true bad?

От
Net Llama!
Дата:
Greetings,
I've been tasked with maintaining a postgresql-7.3.4 database that has a
J2EE app on the front end.

In the pgsql log I see thousands upon thousands of entries like these:
WARNING:  COMMIT: no transaction in progress

Through a little googling, I've determined it means that the folks who
wrote the J2EE app have set autocommit=true.  I'm not, by any means, a
java programmer, so I'm not sure if setting autocommit=true serves any
useful purpose, other than not having to add BEGIN and END statements to
your code.

At any rate, are there any negative consequences to setting setting
autocommit=true, such as performance hits (and the obvios filling up
diskspace because of the logging)?

thanks!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman                netllama@linux-sxs.org
Linux Step-by-step & TyGeMo             http://netllama.ipfox.com

Re: Is autocommit=true bad?

От
Alex Satrapa
Дата:
Net Llama! wrote:
> At any rate, are there any negative consequences to setting setting
> autocommit=true, such as performance hits (and the obvios filling up
> diskspace because of the logging)?

The greatest negative consequence will be that the code obviously isn't
doing what the programmers think it's doing. The log entry is occuring
because someone is issuing a COMMIT somewhere - obviously expecting that
they're in a transaction at that point.

Check the code, and consider turning autocommit off if it looks like you
need a transaction over more than one statement.


Re: Is autocommit=true bad?

От
Kris Jurka
Дата:

On Tue, 27 Jan 2004, Net Llama! wrote:

> Greetings,
> I've been tasked with maintaining a postgresql-7.3.4 database that has a
> J2EE app on the front end.
>
> In the pgsql log I see thousands upon thousands of entries like these:
> WARNING:  COMMIT: no transaction in progress

I believe this is a symptom of an old version of the jdbc driver.  Perhaps
upgrading that would make this go away.

Kris Jurka



Re: Is autocommit=true bad?

От
Net Llama!
Дата:
On Wed, 28 Jan 2004, Kris Jurka wrote:
> On Tue, 27 Jan 2004, Net Llama! wrote:
>
> > Greetings,
> > I've been tasked with maintaining a postgresql-7.3.4 database that has a
> > J2EE app on the front end.
> >
> > In the pgsql log I see thousands upon thousands of entries like these:
> > WARNING:  COMMIT: no transaction in progress
>
> I believe this is a symptom of an old version of the jdbc driver.  Perhaps
> upgrading that would make this go away.

OK thanks.  I'm pretty ignorant of jdbc drivers.  How could I determine
what version is the most recent, and which version is in use?  thanks.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J Friedman                netllama@linux-sxs.org
Linux Step-by-step & TyGeMo             http://netllama.ipfox.com

Re: Is autocommit=true bad?

От
Kris Jurka
Дата:

On Wed, 28 Jan 2004, Net Llama! wrote:

> On Wed, 28 Jan 2004, Kris Jurka wrote:
> > On Tue, 27 Jan 2004, Net Llama! wrote:
> >
> > > Greetings,
> > > I've been tasked with maintaining a postgresql-7.3.4 database that has a
> > > J2EE app on the front end.
> > >
> > > In the pgsql log I see thousands upon thousands of entries like these:
> > > WARNING:  COMMIT: no transaction in progress
> >
> > I believe this is a symptom of an old version of the jdbc driver.  Perhaps
> > upgrading that would make this go away.
>
> OK thanks.  I'm pretty ignorant of jdbc drivers.  How could I determine
> what version is the most recent, and which version is in use?  thanks.
>

The most recent version is 7.4.1 and can be downloaded from here:
http://jdbc.postgresql.org/download.html  This will work on all older
versions and should be used regardless of your database version.  To
determine what version you currently have you can use something like
this...

Connection conn = /* Get connection somehow */
DatabaseMetaData dbmd = conn.getMetaData();
System.out.println(dbmd.getDriverVersion());

Kris Jurka