Re: [sqlite] some questions about sqlite
On Sat, Sep 01, 2012 at 11:56:33PM -0700, J Decker scratched on the wall: > On Sat, Sep 1, 2012 at 8:24 PM, Jay A. Kreibich wrote: > > On Sat, Sep 01, 2012 at 07:37:04PM -0700, J Decker scratched on the wall: > >> On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: > >> > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > > > >> >> 2??how many user connections the sqlite can handler > >> > > >> > There is no limit in SQLite for connections. > >> > >> It is not advised to have multiple processes connect to same file. .. > >> but in-process probably no limit of connections. > > > > I'm not sure where this idea comes from, as it is perfectly > > acceptable to have multiple processes accessing the same database > > file. > > > > SQLite makes very little distinction between different connections > > from the same process and different connections from different > > processes, so there isn't any significant limit that applies to one > > situation that doesn't apply to the other. > > > > Concurrency is always an issue, and you don't want hundreds of > > connections banging on the same file, but that's true no matter if > > the connections come from the same process or not. > the point would be 'and not have concurrancy issues that I'd have to > solve myself...' SQLite uses file locks to control concurrent access between all the connections. This is true if the connections come from the same process or different processes. Accessing the same SQLite file from multiple connections/threads/processes is perfectly safe. About the only time you run into concurrent access issues is if you attempt to access an SQLite database on a network-based file system. Most network-based file systems don't do locks correctly (and definitely don't do distributed locks correctly), so there can be issues. This case is well known and well documented and can be considered a bug in the network filesystem implementations. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] some questions about sqlite
> but about the second question,I write java code,and find if the connection > exceeds 17990,then will throws exception > SQLite.Exception: unknown error in open > at SQLite.Database._open4(Native Method) > at SQLite.Database.open(Database.java:37) > at SQLite.MyDay.main(MyDay.java:20) > Exception in thread "main" java.lang.OutOfMemoryError: unable to get SQLite Buy more memory. --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.org ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] some questions about sqlite
On 2 Sep 2012, at 7:56am, J Decker wrote: > the point would be 'and not have concurrancy issues that I'd have to > solve myself...' Apache runs one process for each request it's serving [1]. I have multiple Apache processes -- i.e. multiple web page requests -- accessing the same database (using the sqlite3 PHP library) at the same time. I think I noticed a log last year which showed ten simultaneous processes all within the same second. SQLite serialised the requests using locking and everything worked as designed. Everyone got an acceptably fast response with no problems. I wasn't even using any special compilation options or PRAGMAs. Simon. [1] Handwave here. If you know the details you don't need me to explain them. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] some questions about sqlite
On Sat, Sep 1, 2012 at 8:24 PM, Jay A. Kreibich wrote: > On Sat, Sep 01, 2012 at 07:37:04PM -0700, J Decker scratched on the wall: >> On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: >> > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > >> >> 2??how many user connections the sqlite can handler >> > >> > There is no limit in SQLite for connections. >> >> It is not advised to have multiple processes connect to same file. .. >> but in-process probably no limit of connections. > > I'm not sure where this idea comes from, as it is perfectly > acceptable to have multiple processes accessing the same database > file. > > SQLite makes very little distinction between different connections > from the same process and different connections from different > processes, so there isn't any significant limit that applies to one > situation that doesn't apply to the other. > > Concurrency is always an issue, and you don't want hundreds of > connections banging on the same file, but that's true no matter if > the connections come from the same process or not. > the point would be 'and not have concurrancy issues that I'd have to solve myself...' >-j > > -- > Jay A. Kreibich < J A Y @ K R E I B I.C H > > > "Intelligence is like underwear: it is important that you have it, > but showing it to the wrong people has the tendency to make them > feel uncomfortable." -- Angela Johnson > ___ > 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] some questions about sqlite
> thanks a lot, > but about the second question,I write java code,and find if the connection > exceeds 17990,then will throws exception This probably happened because your OS restricts number of open file descriptors or something like that. Pavel On Sat, Sep 1, 2012 at 7:52 PM, wrote: > thanks a lot, > but about the second question,I write java code,and find if the connection > exceeds 17990,then will throws exception > SQLite.Exception: unknown error in open > at SQLite.Database._open4(Native Method) > at SQLite.Database.open(Database.java:37) > at SQLite.MyDay.main(MyDay.java:20) > Exception in thread "main" java.lang.OutOfMemoryError: unable to get SQLite > handle > at SQLite.Database._open4(Native Method) > at SQLite.Database.open(Database.java:37) > at SQLite.MyDay.main(MyDay.java:20) > > the source java code: > public static void main(String[] args) { > // TODO Auto-generated method stub > int count=0; > > while(count<=17990){ > Database db = new Database(); > > try { > // open connection,but not close > db.open("c:\\my1.db", 0666); > count++; > db.interrupt(); > db.busy_timeout(1000); > db.busy_handler(null); > > } catch (Exception e) { > e.printStackTrace(); > } > } > > System.out.println(count); > } > > >> -Original E-mail----- >> From: "J Decker" >> Sent Time: 2012-9-2 10:37:04 >> To: "General Discussion of SQLite Database" >> Cc: >> Subject: Re: [sqlite] some questions about sqlite >> >> On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: >> > >> > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: >> > >> >> 1、Do the sqlite support job like oracle or sqlserver,such as >> >>variable job1 number; >> >>begin >> >>sys.dbms_job.submit(job => :job, >> >>what => 'prc_g_test;', >> >> next_date => to_date('22-10-2008 10:06:41', >> >> 'dd-mm- hh24:mi:ss'), >> >> interval => >> >> 'sysdate+1/1440');--每天1440分钟,即一分钟运行test过程一次 >> >> commit; >> >>end; >> > >> > No. >> > >> >> 2、how many user connections the sqlite can handler >> > >> > There is no limit in SQLite for connections. >> >> It is not advised to have multiple processes connect to same file. .. >> but in-process probably no limit of connections. >> >> > >> > 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 > > ___ > 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] some questions about sqlite
On Sat, Sep 01, 2012 at 07:37:04PM -0700, J Decker scratched on the wall: > On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: > > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > >> 2??how many user connections the sqlite can handler > > > > There is no limit in SQLite for connections. > > It is not advised to have multiple processes connect to same file. .. > but in-process probably no limit of connections. I'm not sure where this idea comes from, as it is perfectly acceptable to have multiple processes accessing the same database file. SQLite makes very little distinction between different connections from the same process and different connections from different processes, so there isn't any significant limit that applies to one situation that doesn't apply to the other. Concurrency is always an issue, and you don't want hundreds of connections banging on the same file, but that's true no matter if the connections come from the same process or not. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] some questions about sqlite
thanks a lot, but about the second question,I write java code,and find if the connection exceeds 17990,then will throws exception SQLite.Exception: unknown error in open at SQLite.Database._open4(Native Method) at SQLite.Database.open(Database.java:37) at SQLite.MyDay.main(MyDay.java:20) Exception in thread "main" java.lang.OutOfMemoryError: unable to get SQLite handle at SQLite.Database._open4(Native Method) at SQLite.Database.open(Database.java:37) at SQLite.MyDay.main(MyDay.java:20) the source java code: public static void main(String[] args) { // TODO Auto-generated method stub int count=0; while(count<=17990){ Database db = new Database(); try { // open connection,but not close db.open("c:\\my1.db", 0666); count++; db.interrupt(); db.busy_timeout(1000); db.busy_handler(null); } catch (Exception e) { e.printStackTrace(); } } System.out.println(count); } > -Original E-mail- > From: "J Decker" > Sent Time: 2012-9-2 10:37:04 > To: "General Discussion of SQLite Database" > Cc: > Subject: Re: [sqlite] some questions about sqlite > > On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: > > > > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > > > >> 1、Do the sqlite support job like oracle or sqlserver,such as > >>variable job1 number; > >>begin > >>sys.dbms_job.submit(job => :job, > >>what => 'prc_g_test;', > >> next_date => to_date('22-10-2008 10:06:41', > >> 'dd-mm- hh24:mi:ss'), > >> interval => > >> 'sysdate+1/1440');--每天1440分钟,即一分钟运行test过程一次 > >> commit; > >>end; > > > > No. > > > >> 2、how many user connections the sqlite can handler > > > > There is no limit in SQLite for connections. > > It is not advised to have multiple processes connect to same file. .. > but in-process probably no limit of connections. > > > > > 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 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] some questions about sqlite
On Sat, Sep 1, 2012 at 7:32 PM, Simon Slavin wrote: > > On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > >> 1、Do the sqlite support job like oracle or sqlserver,such as >>variable job1 number; >>begin >>sys.dbms_job.submit(job => :job, >>what => 'prc_g_test;', >> next_date => to_date('22-10-2008 10:06:41', >> 'dd-mm- hh24:mi:ss'), >> interval => >> 'sysdate+1/1440');--每天1440分钟,即一分钟运行test过程一次 >> commit; >>end; > > No. > >> 2、how many user connections the sqlite can handler > > There is no limit in SQLite for connections. It is not advised to have multiple processes connect to same file. .. but in-process probably no limit of connections. > > 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] some questions about sqlite
On 2 Sep 2012, at 3:13am, shuif...@mail.ustc.edu.cn wrote: > 1、Do the sqlite support job like oracle or sqlserver,such as >variable job1 number; >begin >sys.dbms_job.submit(job => :job, >what => 'prc_g_test;', > next_date => to_date('22-10-2008 10:06:41', > 'dd-mm- hh24:mi:ss'), > interval => > 'sysdate+1/1440');--每天1440分钟,即一分钟运行test过程一次 > commit; >end; No. > 2、how many user connections the sqlite can handler There is no limit in SQLite for connections. Simon. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users