[sqlite] solving the infamous, irritating database locked problem

2005-06-09 Thread Puneet Kishor
I've been a reading a lot on the database locked problem, but still 
need guidance trying to locate the source of my problem.


environment: DBI/DBD::SQLite (latest versions) with SQLite3 (3.2.1) on 
Mac OS X (10.3.9).


I am trying to update a table via the web. The UPDATE in question is 
the very first (and the only) DML statement. Yet, I get the database 
locked error.


The sequence of commands is

my $sql = UPDATE statement;
my $sth = $dbh-prepare(qq{$sql});
$sth-execute;
$dbh-commit;

My question is: could I set some kind of trace that tells me what is 
going on with SQLite?


Many thanks.

--
Puneet Kishor



Re: [sqlite] solving the infamous, irritating database locked problem

2005-06-09 Thread Jay Sprenkle
I'm not familar with the wrapper you're using, but don't you have a
commit without a matching begin? Did you establish a lock on the table
before
trying to update? Are you updating a table that you currently are reading from?
As in:
select * from t;
for each result
  update t set field = blah;
next

On 6/9/05, Puneet Kishor [EMAIL PROTECTED] wrote:
 I've been a reading a lot on the database locked problem, but still
 need guidance trying to locate the source of my problem.
 
 environment: DBI/DBD::SQLite (latest versions) with SQLite3 (3.2.1) on
 Mac OS X (10.3.9).
 
 I am trying to update a table via the web. The UPDATE in question is
 the very first (and the only) DML statement. Yet, I get the database
 locked error.
 
 The sequence of commands is
 
 my $sql = UPDATE statement;
 my $sth = $dbh-prepare(qq{$sql});
 $sth-execute;
 $dbh-commit;
 
 My question is: could I set some kind of trace that tells me what is
 going on with SQLite?
 
 Many thanks.
 
 --
 Puneet Kishor
 
 


-- 
---
You a Gamer? If you're near Kansas City:
Conquest 36
https://events.reddawn.net

The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264


Re: [sqlite] solving the infamous, irritating database locked problem

2005-06-09 Thread Puneet Kishor


On Jun 9, 2005, at 9:35 AM, Jay Sprenkle wrote:


I'm not familar with the wrapper you're using, but don't you have a
commit without a matching begin?


The commit is in the wrapper, not in the SQL. When making a database 
connection, I specified to turn AutoCommit to OFF. Hence, I have to 
explicitly $dbh-commit (unless I understand DBI incorrectly, in which 
case, I hope some Perl-ers on this list might correct me).



Did you establish a lock on the table
before
trying to update?


Nope, nothing that I did to create such a lock. The UPDATE in question 
is the very first statement.



Are you updating a table that you currently are reading from?
As in:
select * from t;
for each result
  update t set field = blah;
next


Nope. the sequence I've described below is exactly how it goes. Create 
an UPDATE statement. Execute it. Commit it. Wait for the error message 
to pop up telling me that the database is locked.


Haumph!




On 6/9/05, Puneet Kishor [EMAIL PROTECTED] wrote:

I've been a reading a lot on the database locked problem, but still
need guidance trying to locate the source of my problem.

environment: DBI/DBD::SQLite (latest versions) with SQLite3 (3.2.1) on
Mac OS X (10.3.9).

I am trying to update a table via the web. The UPDATE in question is
the very first (and the only) DML statement. Yet, I get the database
locked error.

The sequence of commands is

my $sql = UPDATE statement;
my $sth = $dbh-prepare(qq{$sql});
$sth-execute;
$dbh-commit;

My question is: could I set some kind of trace that tells me what is
going on with SQLite?

Many thanks.

--
Puneet Kishor





--
---
You a Gamer? If you're near Kansas City:
Conquest 36
https://events.reddawn.net

The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264


--
Puneet Kishor



Re: [sqlite] solving the infamous, irritating database locked problem

2005-06-09 Thread Scott Leighton
On Thursday 09 June 2005 7:15 am, Puneet Kishor wrote:
 I've been a reading a lot on the database locked problem, but still
 need guidance trying to locate the source of my problem.

 environment: DBI/DBD::SQLite (latest versions) with SQLite3 (3.2.1) on
 Mac OS X (10.3.9).

 I am trying to update a table via the web. The UPDATE in question is
 the very first (and the only) DML statement. Yet, I get the database
 locked error.

 The sequence of commands is

 my $sql = UPDATE statement;
 my $sth = $dbh-prepare(qq{$sql});
 $sth-execute;
 $dbh-commit;

 My question is: could I set some kind of trace that tells me what is
 going on with SQLite?


Try this

 my $sql = UPDATE statement;
 my $sth = $dbh-prepare(qq{$sql}) || die $dbh-errstr;

 $dbh-begin_work;
 $sth-execute || die $dbh-errstr;
 $dbh-commit;


Scott


-- 
POPFile, the OpenSource EMail Classifier
http://popfile.sourceforge.net/
Linux 2.6.11.4-21.7-default x86_64