Yeah , thats what probably is the issue.. So i will take a sequential approach over there and update it .. Thanks a lot Kostya.. Regards, Alok.
On Fri, Oct 22, 2010 at 6:49 PM, Kostya Vasilyev <[email protected]> wrote: > Yes, that's what I meant. > > Always call getWritableDatabase, and don't call SQLiteDatabase.openDatabase > - are you, perhaps, somewhere in your code? > > In the link you posted, table upgrades are done by renaming the old table > and creating a new table from scratch, then copying the data. So there is > the time period when the table doesn't exist. Most likely, this is the > reason why you're seeing your error. > > Since you've said that your code is multithreaded, I think what happens is, > one thread starts upgrading the database, while another thread starts to > make queires, or perhaps tries to perform an upgrade as well. > > To fix this issue, you need to add thread synchronization around opening the > database, to avoid concurrent access until the database has been fully > upgraded. > > -- Kostya > > 22.10.2010 17:03, Alok Kulkarni пишет: >> >> I am following this >> >> http://efreedom.com/Question/1-3505900/SQLiteOpenHelper-OnUpgrade-Confusion-Android >> >> What do u mean by saying "SQL open helper for all code paths" >> I am using the standard code for >> public void open() throws SQLException { >> db = DBHelper.getWritableDatabase(); >> } >> The open method is called for each database seperately. >> >> >> On Fri, Oct 22, 2010 at 6:26 PM, Alok Kulkarni<[email protected]> wrote: >>> >>> Yeah ill do my best.. My code is too complicated right now... :P >>> One more thing i need to confirm.. After upgrade , all the old >>> databases are deleted right.. So i need to backup all the tables in >>> the onUpgrade and recreate new ones .. Right ? >>> >>> On Fri, Oct 22, 2010 at 6:20 PM, Kostya Vasilyev<[email protected]> >>> wrote: >>>> >>>> Sounds like this could be it. >>>> >>>> Can't you just go through SQL open helper for all code paths? >>>> >>>> -- Kostya >>>> >>>> 22.10.2010 16:37, Alok Kulkarni пишет: >>>>> >>>>> No. Actually i am accessing another table from my databases at the >>>>> same time from another thread while onUpgrade is being called.So i >>>>> think thats where the problem lies.But i need to figure out a way so >>>>> that i access the SQL tables after the on Upgrade function completes. >>>>> >>>>> On Fri, Oct 22, 2010 at 5:58 PM, Kostya Vasilyev<[email protected]> >>>>> wrote: >>>>>> >>>>>> AFAIK, there is nothing special, except: >>>>>> >>>>>> - onUpgrade may take some time to run >>>>>> - the tables are not updated until after onUpgrade is done >>>>>> >>>>>> Are you accessing the database in any way bypassing your SQL open >>>>>> helper? >>>>>> >>>>>> Is this what you mean by " >>>>>> >>>>>> At the start of the application , >>>>>> i initialize all the databases and access columns from the required >>>>>> tables >>>>>> >>>>>> " >>>>>> ? >>>>>> >>>>>> If you're relying on SQL open helper and its onUpgrade, then that >>>>>> should >>>>>> be >>>>>> the only way you're accessing the database. >>>>>> >>>>>> -- Kostya >>>>>> >>>>>> 22.10.2010 15:14, Alok Kulkarni пишет: >>>>>>> >>>>>>> Hi, >>>>>>> I have multiple databases in my app.At the start of the application , >>>>>>> i initialize all the databases and access columns from the required >>>>>>> tables.What i did is , for one of the databases i incremented the >>>>>>> version of the DB. So now i have started getting error of " No Such >>>>>>> table say ABCD while compiling " query.This table is in another DB >>>>>>> than the updated DB. I dont have any code in the onUpgrade right >>>>>>> now.. >>>>>>> Is there any thing thats striking anyone why this behavior is >>>>>>> happening? Is there anything that happens in the onUpgrade method >>>>>>> that >>>>>>> causes all the DBs to be inaccessable temporarily. I am saying this >>>>>>> because if i place a breakpoint in onUpgrade and debug , then i wait >>>>>>> for a few seconds on the 1st stmt in onUpgrade and then everything >>>>>>> works fine... >>>>>>> >>>>>> -- >>>>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- >>>>>> http://kmansoft.wordpress.com >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Android Developers" group. >>>>>> To post to this group, send email to >>>>>> [email protected] >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected] >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/android-developers?hl=en >>>> >>>> -- >>>> Kostya Vasilyev -- WiFi Manager + pretty widget -- >>>> http://kmansoft.wordpress.com >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Developers" group. >>>> To post to this group, send email to [email protected] >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> For more options, visit this group at >>>> http://groups.google.com/group/android-developers?hl=en > > > -- > Kostya Vasilyev -- WiFi Manager + pretty widget -- > http://kmansoft.wordpress.com > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

