Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers
Accepted Solution

how to clear old database?

Hello,

 

I am working with an SQLite database. However, I am getting intermittent behaviour from my app within the simulator. I suspect it is because while developing I have to hard exit the simulator and am leaving the database in an unknown state.

 

How can I clear/delete the old database so that I know I am starting the app from a known state? I have tried using clean.bat, but I haven't had any success with it yet.

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 246
Registered: ‎12-13-2010
My Device: Not Specified

Re: how to clear old database?

DatabaseFactory.delete(file_path);

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

Hi shism2:

 

Are you sure that will work for a WebWorks app? I seem to recall that is from Java, but I don't think there is a file path for the WebWorks SQLite database.

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: how to clear old database?

[ Edited ]

You are simulating an SD card to use the WebSQL I assume, so you can locate the DB files here:

 

C:\[SDCardDir]/BlackBerry/system/appdata/rim/webstorage/[appName]

 

appName may be base64(appName) if you're using OS5. Delete the whole folder manually using Windows explorer.

 

From within the app, "DROP TABLE.." will remove it, but doesn't help if you can't open because it was corrupted. Here you can use  blackberry.io.dir.exists() to make sure the directory actually exists, then use  blackberry.io.dir.deleteDirectory([path]) where path == file:///SDCard/BlackBerry/System...

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

Hi shnuffy,

 

Under ...\Blackberry\system\ I only see a media folder. There is no appdata folder.

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 268
Registered: ‎08-19-2009
My Device: Bold 9700

Re: how to clear old database?

What device are you using? It may be under //store/

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

Hi shnuffy,

 

I'm simulating on 9810, and I don't see a /store folder anywhere in my SD image folder.

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

Correction: clean.bat does delete the database from the simulator. However, this doesn't work for an actual device.

 

Any way to clear/delete an old version of the database from a device (smartphone)?

 

Thanks,

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

I'm finding now that clean.bat doesn't seem to totally clear the old database. Any way to totally delete the old database, either on the simulator or on the device?

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: how to clear old database?

My apologies - shnuffy had it right the first time. I have now found the directory where the database is stored. As shnuffy said: Device/Blackberry/system/appdata/rim/webstorage/...

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.