What is your sequence of calls?

What do you mean by "one connection for the application lifetime" and "others 
on demand for each transaction"?

A "connection" is created/destroyed (aka opened/closed) with sqlite3_open resp. 
sqlite3_close calls. This opens/closes the underlying file handles.

A "statement" is created/destroyed with sqlite3_prepare resp. sqlite3_finalize 
calls. Unfinalized statements will prevent sqlite3_close from working and 
return an error code.

My guess is you are not finalizing your statements and not checking 
sqlite3_close return status, thus missing SQLite having a lot of open files. Is 
there a lsof command or a /proc filesystem or equivalent?

-----Ursprüngliche Nachricht-----
Von: Grzegorz Sikorski [mailto:g.sikor...@kelvatek.com]
Gesendet: Mittwoch, 02. Juli 2014 13:02
An: sqlite-users@sqlite.org
Betreff: [sqlite] Problem with many connections

Hi,

I am not sure if my previous email had reached the list, so I just repeat it:

I am developing sharding database using SQLite3 for embedded application. My 
code works fine up to about 1020 connections to the database. After around this 
number, I get an error "unable to open database file". I double checked, 
permissions are OK and I think I always properly close all connections and 
never open the same file twice (I normally keep one connection opened for whole 
application lifetime and open others on demand for each transaction). I found 
this 
topic:http://stackoverflow.com/questions/22801987/sqlite3-unable-to-open-database-file-ios
  and I am not sure if there is any reason why keeping opened connection in 
whole application lifetime is really something I should do? I would prefer to 
open database only when it is needed, to avoid risk of file corruption on power 
loss. Is there any known issue with multiple open/close operations?

Regards,
Greg


--
ExchangeDefender Message Security: Click below to verify authenticity 
https://admin.exchangedefender.com/verify.php?id=s62B2QLa005874&from=g.sikor...@camlintechnologies.com


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


-----------------------------------------------------------------------
Gunter Hick
Software Engineer

Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna,
Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then
delete this message from your system. Please do not copy it or use it for any 
purposes, or disclose its contents to any person as to do so could be a breach 
of confidence. Thank you for your cooperation.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to