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

Adobe AIR Development

Reply
Developer
Posts: 63
Registered: ‎12-10-2012
My Device: Blackberry 9900
My Carrier: Vodafone-in
Accepted Solution

BB10 Database

I am trying to create a database in BB10 platform. I did create connection and yes I did make tables. But I couldn't find database anywhere in my source project. Is it that way? or not..? Also is there any way to view the tables and contents. 

My database currently contain a table with one field for entering names. This is the path

    folder.resolvePath("DBSample.db")

 

Any help is appreciated

Thanks in advance 

_______________________________________________________
Help is available everywhere but you have to look at the correct place.
By Me :-)
Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10 Database

[ Edited ]

Well I have not tried and verified this, but since you said "any help is appreciated" Smiley Wink ...

 

Your db probably got created in your application storage directory, which is under

 

/accounts/1000/appdata/<your_app_directory>/data

 

on your device and/or simulator.  You may have to drill down from there but it should be under that

directory.  

 

To get to it you can ssh into the sim and/or device with e.g. putty tools, which can be downloaded 

here, or if you have the NDK installed, you can SSH in using the QNX Momentics IDE.

 

You then probably want to copy the file to your development host using scp or (probably easier)

Momentics.

 

You can then probably view/modify your db using a sqlite shell for your development host OS.

 

Like I said I haven't tested any of this but that's what I'd try.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BB10 Database

I doubt it got created, since you cannot write to the application directory, only the app-storage directory. So you need to write it there if you want it in the app's sandbox. You can write it to the shared directory where you then have easy access to it to inspect it with a SQLLite DB reader app.
Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10 Database


jtegen wrote:
I doubt it got created, since you cannot write to the application directory, only the app-storage directory. So you need to write it there if you want it in the app's sandbox. You can write it to the shared directory where you then have easy access to it to inspect it with a SQLLite DB reader app.

John I'm not following your above comment - I was assuming the original poster's "folder" variable was an instance of

flash.filesystem.File, but wasn't assuming from their post that they were trying to write it to the applicaiton directory,

and in my response I did specify the app storage directory, not the app directory.  I guess we'll have to wait to

hear back from the orginal poster as to where they were trying to write the db.

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BB10 Database

It is best to do something like:
var dbfile : File = File.documentsDirectory.resolvePath( 'my.db' );

If the original post "folder" was the documents directory, then they should be OK.
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BB10 Database

This also assumes they set the correct permission to write to the shared folder.
Highlighted
Developer
Posts: 1,269
Registered: ‎12-29-2010
My Device: PlayBook, Z10 LE, Dev Alpha C

Re: BB10 Database

The way I read the original poster's message, it sounded like they were maybe expecting the database to get written into a file somewhere in their project directory - something which is not going to happen.

 

Even if you are iterating on business logic and running on your development host OS using adl, your db file is not going to get written in your project directory, but rather in your application sandbox on your host OS, which on e.g. a Windows XP box will be something like:

 

C:\Documents and Settings\<username>\Application Data\<application name>\