RE: Perl-Postgres connection: 'Commit' method not found in DBI. Advice?




It looks like you're calling commit() on the $sth instead of the $dbh.

Philip

Andrew Edson wrote:
I am working with a perl file intended to enter a postgresql database
(as user postgres), select a list of key values based on one of those
values and delete any records which match the returned results. The
purpose of the program is to delete inactive records from the
database that are over two years in age.

(For the record, the system in question is running SuSE 9.3 os,
Apache2, Postgres 8.1.3, and appears to be running Perl 5.8.6)

When I first ran the perl script, it did not appear to be working;
entering the database afterwards would show that the data was still
present. After finding and uncommenting a 'commit' statement at the
end, I am now ending up with the error message

Can't locate object method "commit" via package "DBI::st" at
./purge_acnt line 242 (#1)
(F) You called a method correctly, and it correctly indicated a
package functioning as a class, but that package doesn't define
that particular method, nor does any of its base classes. See
perlobj. Uncaught exception from user code:
Can't locate object method "commit" via package "DBI::st" at
./purge_acnt line 242. at ./purge_acnt line 242
Database handle destroyed without explicit disconnect at ./purge_acnt
line 242.
Database handle destroyed without explicit disconnect at ./purge_acnt
line 242.

I am asuming that the last two lines are because the program
crashed, artificially severing the connections to the DB. (The last
couple of lines of the program are normal disconnect statements, but
occur after the 'commit' line that triggered the error.) It's the
rest of the error that I am confused about. If I am reading it
correctly, it seems to be saying that there is no 'commit' function
in the DBI. Do I need to update my DBI files somehow, or is there
another way to prevent this error from occuring? And if I have to
update, would someone please be kind enough to link me to a good set
of instructions on doing so?

Thank you for your consideration.


---------------------------------
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.

.



Relevant Pages

  • Re: [PHP] A no brainer...
    ... that once you commit, the data is there no matter what. ... Unless session storage is used to save time in retrieving data, ... I think it would be kind of fun to run some actual tests. ... it makes no sense for a database to be faster than ...
    (php.general)
  • Re: commit_write= BATCH, NOWAIT; ... how long do I wait?
    ... we've started configuring the database servers with: ... minutes or so worth of transactions, so we're not deeply concerned by ... the durability loss associated with running in asynchronous commit ... Does anybody know how long Oracle will buffer redo in memory before it ...
    (comp.databases.oracle.server)
  • Re: using sqlite3 - execute vs. executemany; committing ...
    ... and also the proper commiting the transactions and closing the connection. ... If the database supports transactions then cursors automatically use ... I suggest that you use the standard cursor methods instead, ... always use .commit() and .close. ...
    (comp.lang.python)
  • Re: commit_write= BATCH, NOWAIT; ... how long do I wait?
    ... we've started configuring the database servers with: ... we can probably afford the loss of 5 ... the durability loss associated with running in asynchronous commit ... Does anybody know how long Oracle will buffer redo in memory before it ...
    (comp.databases.oracle.server)
  • Re: A lazy-committing database object with curry?
    ... > I'm writing a database helper class that represents records in a SQL ... > commit the changes all at once. ... transactionally, and the transaction fails, your in memory objects will ...
    (comp.lang.python)