SQLite database location restriction

by Nathan » Fri, 13 Nov 2009 04:12:26 GMT


Sponsored Links
 I'm reading this restriction on where SQLite databases should reside
on Android.

All databases, SQLite and others, are stored on the device in /data/
data/<package_name>/databases.

While this may be appropriate for small databases that begin and end
within an application's space with a few contacts, this seems rather
restrictive for a large multimedia database that may be used on other
platforms, including Windows, and then transferred to a phone.

In particular, you apparently can't put a database file on a storage
card - which I know end users will want to do.

If this restriction is firm
1. How big can a file get in this location? I'll guess this is OEM
dependent, but, for example, the Verizon Droid is advertising 16GB
preinstalled memory. How much of this would be accessible to
databases? Anything that hasn't been used by the file system yet?
2. Is /data/data/<package_name>/databases a user accessible location
that end users will be able to browse to and place files in?

Nathan

--



SQLite database location restriction

by Nathan » Fri, 13 Nov 2009 11:00:25 GMT


 It seems there is a hard restriction on where SQLite databases
reside.

All databases must be in /data/data/<package_name>/databases,
according to the spec. Specifically, they can't be on a storage card.

This seems ok if the database is a small one that begins and ends with
an adroid app. But for a 1 gig multimedia database that is transferred
from somewhere else, that is limiting.

If this restriction is firm:

1. Is this location user accessible? IE can an end user with an
unlocked phone copy files into there from their desktop computer or
storage card.
2. How much storage space is likely to be available in that location?.
On the 16G droid, for example, how. much of that 16G is accessible?

Thanks

--


Sponsored Links


SQLite database location restriction

by westmeadboy » Fri, 13 Nov 2009 15:22:11 GMT


  http://developer.android.com/intl/en/reference/android/database/sqlite/SQLiteDatabase.html #openOrCreateDatabase(java.io.File,
android.database.sqlite.SQLiteDatabase.CursorFactory)




--



SQLite database location restriction

by Nathan » Fri, 13 Nov 2009 15:44:17 GMT


 Yes, the method
public static SQLiteDatabase openOrCreateDatabase (File file,
SQLiteDatabase.CursorFactory factory)

makes it sound like you can open an arbitrary filename.

But the developer's guide
 http://developer.android.com/guide/topics/data/data-storage.html 

makes it sounds like you can't:

"All databases, SQLite and others, are stored on the device in /data/
data/package_name/databases."

Nathan






--



SQLite database location restriction

by westmeadboy » Fri, 13 Nov 2009 15:50:27 GMT


 Yes, I can see that is misleading. I'm sure they just mean that for
when you don't specify a File.

Have you tried putting it on the sdcard? I have an app, used by
thousands of users, where a 20MB+ sqlite db file is located on the
sdcard.

Hope this helps!






--



SQLite database location restriction

by Nathan » Sat, 14 Nov 2009 01:23:04 GMT


 


Yes, it does. That's what I needed to know. I hadn't tried to code it
yet - I was reading the manual for once and found this tidbit that
could have big implications.

Given your experience, the chance that it will seem to work and then
blow up later sounds pretty small.

Nathan

--



Other Threads

1. Sliding screen controlled by button

How do I set up a button in the middle of each item of a list view (or
is it expandable?) such that the horizontal movement of the button to
either end of the screen in portrait mode will lead to the activity
page to slide and display another activity based on the direction the
button is moved?

-- 

2. SeekBar problem

Ok I've been able to obtain the slider update with this funny trick:

seekTime.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

public void onStopTrackingTouch(SeekBar seekBar)
 {
 final int progress = seekBar.getProgress();
 seekBar.setMax(progress * 2);
 *seekBar.setProgress(progress+1);*
* **seekBar.setProgress(progress-1);*

}
[...]

If i just do a setProgress(progress) it have no effect because it probably
recognize the same value and think that nothing is to update. I hope this
will help somebody in the future.

Roberto Previdi

-- 

3. Re-size Tab child when soft keyboard is shown

4. Help with LiveWallpaper and Camera

5. DBus in android

6. Android Market, specify products in Dollars instead of euros.

7. computer bluetooth's UUID