[sqlite] database is locked with create

2013-02-19 Thread Choi, David
Hi all,

I am new to sqlite. I build sqlite with buildroot without any issue. After 
loading sqlite on my embedded board, I always get one error message:database 
is locked.

Here is my operation on  my board:

#sqlite3 ex1
SQLite version 3.6.23.1
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlite create table tbl1(one varchar(10), two smallint);
Error: database is locked
sqlite 

Any suggestion will be highly appreciated.

Regards,
David J. Choi
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database is locked with create

2013-02-19 Thread Choi, David
Hi Simon,

Thank you for your clear instruction. But still I have the same issue.


Here is my test procedures:

#cd /home
#sqlite3 ex1
SQLite version 3.6.23.1
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlitecreate table tbl1(one varchar(10),two smallint);
sqlite3_exec: PH3: rc=101sqlite3_exec: PH7:rc=101sqlite3_exec: 
PH8:rc=0sqlite3_exec: PH9sqlite3_exec: PH10:rc=0sqliteErrorFromPosixError: 
SQLITE_BUSY: sqliteIOErr=3850
Error: database is locked
sqlite .exit
/home # ls -l
total 4
drwxr-xr-x2 default  default  0 Feb 19 11:08 default
-rw-r--r--1 root root 0 Feb 19 13:26 ex1
/home # rm ex1
/home # sqlite3 ex1
SQLite version 3.6.23.1
Enter .help for instructions
Enter SQL statements terminated with a ;
sqlite create table tbl1(one varchar(10), two smallint);
sqlite3_exec: PH3: rc=101sqlite3_exec: PH7:rc=101sqlite3_exec: 
PH8:rc=0sqlite3_exec: PH9sqlite3_exec: PH10:rc=0sqliteErrorFromPosixError: 
SQLITE_BUSY: sqliteIOErr=3850
Error: database is locked
sqlite .exit
/home # ls
default  ex1
/home # ls -l ex1
-rw-r--r--1 root root 0 Feb 19 13:27 ex1
/home # rm ex1 
/home # touch aaa
/home # ls
aaa  default  ex1
/home # echo this is test file  aaa
/home # cat aaa
this is test file

Regards,
David J. Choi


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Tuesday, February 19, 2013 9:14 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] database is locked with create


On 19 Feb 2013, at 5:01pm, Choi, David david.c...@micrel.com wrote:

 I am new to sqlite. I build sqlite with buildroot without any issue. After 
 loading sqlite on my embedded board, I always get one error message:database 
 is locked.
 
 Here is my operation on  my board:
 
 #sqlite3 ex1
 SQLite version 3.6.23.1
 Enter .help for instructions
 Enter SQL statements terminated with a ;
 sqlite create table tbl1(one varchar(10), two smallint);
 Error: database is locked
 sqlite 
 
 Any suggestion will be highly appreciated.

Quit the shell program.
Locate the database file called 'ex1' and make sure it is in the folder you 
expect it to be in.
If the database file still exists, delete it.
Try again, letting the shell program create a new database.

If this also doesn't work,

Check the privileges in the folder where the database file is created.
Do you have write privileges inside that folder ?
Try using copy command or a simple text editor to make a file in that folder.
Does it work or do you get a similar error to 'file is locked' ?

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database is locked with create

2013-02-19 Thread Choi, David
Hi Richard,

I think your guess is highly possible because the error comes from 
sqliteErrorFromPosixError(). In that case, how can I fix the issue?

Regards,
David J. Choi


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Tuesday, February 19, 2013 9:44 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] database is locked with create

On Tue, Feb 19, 2013 at 12:01 PM, Choi, David david.c...@micrel.com wrote:

 Hi all,

 I am new to sqlite. I build sqlite with buildroot without any issue. 
 After loading sqlite on my embedded board, I always get one error 
 message:database is locked.

 Here is my operation on  my board:

 #sqlite3 ex1
 SQLite version 3.6.23.1
 Enter .help for instructions
 Enter SQL statements terminated with a ;
 sqlite create table tbl1(one varchar(10), two smallint);
 Error: database is locked
 sqlite 

 Any suggestion will be highly appreciated.


I'm guessing that whatever embedded operating system you are using does not
(correctly) support posix advisory locks.   But that's just a guess.

--
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database is locked with create

2013-02-19 Thread Choi, David
Hi Richard,

It seems that my version is not accept the command. By the way, what is the 
version that you are referring to?

Here is my operation:
/home # sqlite3 --help
Usage: sqlite3 [OPTIONS] FILENAME [SQL]
FILENAME is the name of an SQLite database. A new database is created
if the file does not previously exist.
OPTIONS include:
   -helpshow this message
   -init filename   read/process named file
   -echoprint commands before execution
   -[no]header  turn headers on or off
   -bailstop after hitting an error
   -interactive force interactive I/O
   -batch   force batch I/O
   -column  set output mode to 'column'
   -csv set output mode to 'csv'
   -htmlset output mode to HTML
   -lineset output mode to 'line'
   -listset output mode to 'list'
   -separator 'x'   set output field separator (|)
   -nullvalue 'text'set text string for NULL values
   -version show SQLite version
/home # sqlite3 -version
3.6.23.1
/home # sqlite3 -vfs unix-none ex1
sqlite3: Error: unknown option: -vfs
Use -help for a list of options.


Regards,
David J. Choi


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Tuesday, February 19, 2013 1:44 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] database is locked with create

On Tue, Feb 19, 2013 at 4:39 PM, Choi, David david.c...@micrel.com wrote:

 Hi Richard,

 I think your guess is highly possible because the error comes from 
 sqliteErrorFromPosixError(). In that case, how can I fix the issue?


Try adding the -vfs unix-none command-line option:

 sqlite3 -vfs unix-none ex1

That will disable file locking.  Be warned, however, that with file locking 
disabled, two processes trying to access the database at the same time can lead 
to problems.-- D. Richard Hipp d...@sqlite.org 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database is locked with create

2013-02-19 Thread Choi, David
Hi Richard,

Thank you Richard. 

I get the latest source(sqlite-amalgamation-3071502.zip) and cross-compile. And 
follow your instruction:
sqlite3 -vfs unix-none ex1

That issue is gone.

Really appreciated for your quick and exact response.

David J. Choi


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Richard Hipp
Sent: Tuesday, February 19, 2013 4:04 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] database is locked with create

On Tue, Feb 19, 2013 at 6:37 PM, Choi, David david.c...@micrel.com wrote:

 Hi Richard,

 It seems that my version is not accept the command. By the way, what 
 is the version that you are referring to?


Get the latest: 3.7.15.1.  There is no reason not to.



 Here is my operation:
 /home # sqlite3 --help
 Usage: sqlite3 [OPTIONS] FILENAME [SQL] FILENAME is the name of an 
 SQLite database. A new database is created if the file does not 
 previously exist.
 OPTIONS include:
-helpshow this message
-init filename   read/process named file
-echoprint commands before execution
-[no]header  turn headers on or off
-bailstop after hitting an error
-interactive force interactive I/O
-batch   force batch I/O
-column  set output mode to 'column'
-csv set output mode to 'csv'
-htmlset output mode to HTML
-lineset output mode to 'line'
-listset output mode to 'list'
-separator 'x'   set output field separator (|)
-nullvalue 'text'set text string for NULL values
-version show SQLite version
 /home # sqlite3 -version
 3.6.23.1
 /home # sqlite3 -vfs unix-none ex1
 sqlite3: Error: unknown option: -vfs
 Use -help for a list of options.


 Regards,
 David J. Choi


 -Original Message-
 From: sqlite-users-boun...@sqlite.org [mailto:
 sqlite-users-boun...@sqlite.org] On Behalf Of Richard Hipp
 Sent: Tuesday, February 19, 2013 1:44 PM
 To: General Discussion of SQLite Database
 Subject: Re: [sqlite] database is locked with create

 On Tue, Feb 19, 2013 at 4:39 PM, Choi, David david.c...@micrel.com
 wrote:

  Hi Richard,
 
  I think your guess is highly possible because the error comes from 
  sqliteErrorFromPosixError(). In that case, how can I fix the issue?
 

 Try adding the -vfs unix-none command-line option:

  sqlite3 -vfs unix-none ex1

 That will disable file locking.  Be warned, however, that with file 
 locking disabled, two processes trying to access the database at the 
 same time can lead to problems.-- D. Richard Hipp 
 drh@sqlite.org___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




--
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users