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

Java Development

Reply
Highlighted
New Contributor
Posts: 2
Registered: ‎03-22-2010
My Device: curve
My Carrier: at & t

Simulator and SQLite databasem

Hello.  Blackberry newbie here, looking to port an iPhone app to the RIM world...  The app in question uses SQLite to store product information and images.  In the Java code on the BB, I attempt to open the DB at the location "file:///store/home/user/myDatabasefile.db" but it keeps saying that the SQL is incorrect or that the DB cannot be found.  I believe the problem is that it cannot find the database as the SQL is simply "select * from mytable".  The myDatabasefile.db exists in my project but I'm not sure how to reference it pathwise.  Do I need to copy this file somehow onto the "device" which is the simulator for now?  I've seen sample code but it always creates the DB from scratch.  I've already created and populated my DB...  Any help is appreciate.  I guess this question will help when it comes time to really distro the application on real devices.  I'll know how to copy it into the proper directory...  Thanks in advance!

 

-Brian

 

Developer
Posts: 119
Registered: ‎03-10-2010
My Device: Bold 9000
My Carrier: Rogers

Re: Simulator and SQLite databasem

Hi,

 

The database locations in your device are located as explained here http://docs.blackberry.com/en/developers/deliverables/8682/SQLite_file_locations_719036_11.jsp.

 

When using the simulator, you must point your SDCard directory to any location on your computer (using the simulator menu Simulate->Change SD Card. Considering your DB files are right in this directory, you should be able to open it using "/SDCard/myDatabasefile.db".

 

Check this other document for reference: http://docs.blackberry.com/en/developers/deliverables/8682/BP_SQLite_development_cycle_801356_11.jsp

 

Regads

 

 

 

 



(*) Kudo-me if you really think I helped you!
My plug: I'm doing a Mobile Experiment, reported on my Blog: Check it out!.
---------------------------
Paulo Garcia
http://www.mobilecreators.com - Twitter: http://twitter.com/mobilecreators
New Contributor
Posts: 2
Registered: ‎03-22-2010
My Device: curve
My Carrier: at & t

Re: Simulator and SQLite databasem

Thanks for the response!  The first link you sent didn't work so I wasn't able to look at it.  The second one I had already downloaded and that's where I got the path information for "/store/home/user".  I expected the DB file I have to be copied to that location in lieu of the fact that I have not specified any SD card as existing in the simulator.  Is this an incorrect assumption?  I found a tutorial that suggests a routing to copy the file over "a location" as a byte array but I wasn't sure if that was the prescribed solution or even if it is applicable in my case.  I found that method in the SQLiteDEMO project that came w/ 5.0...  Today, to add insult to injury, my project, though compiling fine, is not getting copied to the Downloads folder in the Simulator.  I'm not sure why.  I've deleted all of the dmp files, etc. but still no dice.  Any thoughts on either of these problems?  I'm using the JDE instead of Eclipse if that helps.  My project is the "Active" one and it builds fine.  I've tried to copy the .cod file manually into the simulator but that doesn't work anymore either.

New Developer
Posts: 7
Registered: ‎08-24-2010
My Device: Bold 9700
My Carrier: Cable & Wireless

Re: Simulator and SQLite databasem

Guess I'm many months behind you, but having similar pains, i.e. downloading code to the simulator and I see nothing in the simulator downloaded apps directory. Did you manage to resolve this?

Developer
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Simulator and SQLite databasem

I don't know if you already did this. In the Run Configurations, Memory , check "Use PC file system for SD Card files" and set a path in your PC to store the files...