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. [Map] Conflict in to MapController between Zoom Level and AnimateTo ?

Dear,

I meet the following problem with the MapApi.

When I click on a POI, I call MapController.animateTo to center the
Map on the Poi

My problem is on some Zoom Level, when "MapController.animateTo" is
called, the map is moving away from the POI.
It's seemed that it's when I zoom In.
If I zoom back, the "MapController.animateTo", is working find.

Does some meet that problem and know a way to fix it ?

(I use the default zoom of the map api)

-- 

2. How to mount /data partition into innersd of my Android device

Hi,

I am working on Android Gingerbread, with customer Device.

Can any one tell me how do i mount my /data to
innersd partiotion.



Thanks in advance

-- 

3. Native email Client di Android Froyo.. support push email kah?

4. how to prevent the app be killed by 鈥渦nmount media鈥?change to usb storage mode)

5. Video Sony Ericsson Arc

6. EditText in Activity show keyboard immediatly

7. Secure requests to a Webservice via Android