tags:

views:

63

answers:

2

Hi All,

Is there any method available for checking the sqlite DB connectivity without calling

sqlite3_open([writableDBPath UTF8String], &database) == SQLITE_OK

everytime. We end up in database connection error after 120 continuous clicks.

Please help.

+1  A: 

First, every sqlite3_open must be matched with a sqlite3_close before open is called with a pointer to that handle again. Otherwise you will have resource leaks, which I think you're experiencing.

Second, why are you repeatedly opening it to begin with?

Matthew Flaschen
Hi,Thanks a lot for the response. I am opening everytime and closing the DB in the end of fetch. So its like opening and closing only but in a very fast way.am i in the right path?
Futur
+2  A: 

You should call sqlite3_open just once. Then, if open operation was successful, store the database handle somewhere globally (i.e., in a class variable) and then just use that handle everytime you need to make a call to the database.

Pablo Santa Cruz
Hi,Thanks a lot for your response. What if i loose the DB connectivity in between? what is the probability that i have the connectivity remain opened all the time?please help
Futur
How do you expect to lose DB connectivity with a iPhone SQLite database?
Matthew Flaschen
Hi, Thanks for your response. So can i confirm that there is no possibility for an app loose the DB connectivity anytime? if this true,I would do what you say... thanks
Futur
Matthew is right. It's almost impossible to loose DB connectivity with an iPhone SQLite database.
Pablo Santa Cruz
Yes you are right, it works fine for me here now.Thanks a lot for your kind responses. Good day to you all.
Futur