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

Native Development

Posts: 148
Registered: ‎04-08-2013
My Device: Blackberry 10
My Carrier: Blackberry
Accepted Solution

Copying from home directory to assests folder


  I created a DB using the following code

bool dbHelper::CreateDataBase()
	    QSqlDatabase database = QSqlDatabase::addDatabase("QSQLITE");
	    bool success = false;
	    if (database.open())
	        alert(tr("Database created/registered."));
	        success = true;
	    } else
	        const QSqlError error = database.lastError();
	        alert(tr("Error opening connection to the database: %1").arg(error.text()));
	    return success;


 Now using the 'Target File system navigator' I can see my DB  inside data folder in sandBox


My problem is:

I want to copy this DB to assets folder  (I want to use it as source for a dataSource) .


How can I do this.Plz help me out with some code



Posts: 62
Registered: ‎11-30-2012
My Device: BlackBerry Z10
My Carrier: Telus

Re: Copying from home directory to assests folder

I don't think you can write to the assets folder on a release build app. So this is a bad idea. What you should be trying to do us copying it to the data folder. Because at least that should be possible. Not sure if it is a good idea though. I don't know how to do this but there's some advice.

If my post helped, click the like button!

Developer of Reader|YC , an open source Hackernews client
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: Copying from home directory to assests folder

if you want to copy this to assets folder to be able to deliver with your app to customers,

then from TargetFileNavigator View copy to FileSystem then drag/drop inside your assets folder


then in your release copy this from assets to users /data to be able to write to the db

ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Posts: 230
Registered: ‎01-12-2013
My Device: z30
My Carrier: Mobile Vikings

Re: Copying from home directory to assests folder

You can't use the database directly as datasource for a listview or something. If you want to do this you will need to convert te records either to a list of an own written class or to a QVariantList with QVariantMap<key, value> wich will be the easiest way I guess.


BB10-OAuth: GitHub
Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Copying from home directory to assests folder

Ekke is correct, but to Curahee's point the Quotes sample shows you how to use a sqlite database as a data source:




It's pretty easy to use the CustomSqlDataSource class with your own SQL query

Paul Bernhardt
Application Development Consultant

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker