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
Contributor
Posts: 15
Registered: ‎04-18-2012
My Device: 9800
My Carrier: Airtel

Need to change the default database location to /SDCard/databases/

Hello all,

 

i need to change the default database location from the blackberry webworks source code

Currently i am using a BB OS 5 sqlite database which uses gears and it automatically gets created in some directory location.

 

I want to modify this location to my needs. Which particular file do i need to modify?

 

Regards,

Nasir

Developer
Posts: 78
Registered: ‎05-17-2012
My Device: 9900 - OS 7.0 Torch device
My Carrier: Reliance

Re: Need to change the default database location to /SDCard/databases/

With my knowledge, it does not create a file or folder without writting the code. In your app code, there might have written the code in such way to store the data in a particular folder. There is CreateDatabase class in which you may need to change the location of your DB.
Contributor
Posts: 15
Registered: ‎04-18-2012
My Device: 9800
My Carrier: Airtel

Re: Need to change the default database location to /SDCard/databases/

My database gets created here C:\sdcard\BlackBerry\system\appdata\rim\gears\VXNhZ2Vtb25pdG9y\local--0\mydatabase.db

 

I donot specify this location.... I just Specify that it gets stored in the C:\sdcard

Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: Need to change the default database location to /SDCard/databases/

[ Edited ]

> I just Specify that it gets stored in the C:\sdcard

How do you do that? Afaik there's no way to specify the location.

Oh wait, you're probably coding in Java, not JavaScript.

 

[edit] whoops, you said Gears. The location cannot be influenced, read this:

http://docs.blackberry.com/en/developers/deliverables/11844/Gears_security_considerations_741979_11....

Why would you need to do that anyway? What's the logic behind it? Why do you actually care about the location?

If you want data to be shared between different apps, then SQLite is not really the way. You can only create empty databases and populate them within the app.

 

And BlackBerry devices do not have the concept of a "C: drive".

Contributor
Posts: 15
Registered: ‎04-18-2012
My Device: 9800
My Carrier: Airtel

Re: Need to change the default database location to /SDCard/databases/

Hi,

 

Actually the logic is that i have a service which runs in the background and makes entry in the database.

While the Application queries this database to get the values.

So inorder to do that i need to access the sqlite database from java and as well as javascript

 

Regards,

Nasir 

Regular Contributor
Posts: 81
Registered: ‎03-09-2012
My Device: PlayBook & Bold 9780
My Carrier: n/a

Re: Need to change the default database location to /SDCard/databases/

Can't you pass a reference to the database from one to the other then? Like create it in the app, and pass the instance to the constructor of the background service? Or vice versa: create the db in the background service, and find a way to pass a reference back to the app.

Or even better yet: allow access to database to background service only, and think of a way to do queries on it there also (SOA approach.) No idea how feasible that is in your situation...