Wednesday, December 15, 2010

[android-developers] Re: Available databases for Android

Enterprise applications generally don't do database access on a
handheld. They generally talk to a server, and the server talks to a
shared database, and it won't be SQLite. Of course, that network IO
needs to be on a background thread.

As long as we're talking in generalities, anyway...

But doing the transactions asynchronously won't violate your
requirements, unless you have a requirement that your application
crash unpredictably with an Application Not Responding message.

Just move the between the beginTransaction() to the endTransaction()
(including those calls) to the doInBackground() method of the
AsyncTask, and everything after the endTransaction() call to the
onPostExecute() method. You don't even have to write any threading
code; it takes care of that for you.

Things like updates to the UI can be handled via the progress
mechanism (for progress) or by posting the actions back to the UI
thread to update fields.

(Of course, if you're doing user input in the middle of a transaction,
you have bigger problems than I can cover here.)

On Dec 15, 5:19 am, Swaroop <gnanaswar...@gmail.com> wrote:
> Bob,
>
> I am primarily referring to enterprise applications which usually have
> a front end and also background threads. I agree that we should try to
> have database commits in an async task even for UI Threads, but not
> always that suits the actual requirement. I am stuck with a few
> scenarios.. So what I plan to do (Still looking into) is to defer the
> background threads if the user makes some action on the page => likely
> to submit the data page soon.
>
> On Dec 15, 5:49 pm, Bob Kerns <r...@acm.org> wrote:
>
>
>
>
>
>
>
> > Re: #2 -- you don't want to do beginTransaction() in your UI thread
> > anyway, really, as it can block if file IO is heavy. (I do, and I'm
> > going to change it). You should make the entire transaction into an
> > AsyncTask, which will keep it out of the UI thread entirely.
>
> > I can't offhand think of a scenario where the lack of multiple
> > connections (and thus serialization of transactions) would be a
> > serious problem on a handheld device. But perhaps I'm just not
> > stretching my brain enough. Still, for most handheld applications,
> > this isn't going to be a serious limitation.
>
> > On Dec 15, 1:45 am, Swaroop <gnanaswar...@gmail.com> wrote:
>
> > > Experts correct me If I am wrong. But putting out the facts, the
> > > things I didn't like SQLite and hope they'd be bettered in the
> > > future.
>
> > > 1) There's no JDBC support for SQLite - I know we can use the Runtime
> > > JDBC Libraries, but it's not recommended -http://stackoverflow.com/questions/1728476/does-android-support-jdbc
> > > 2) No "Connection" support i.e no parallel transactions. You would
> > > have to use 1 SQLDatabase object for 1 database file and at once only
> > > have only one transaction i.e beginTransaction() and endTransaction()
> > > happening at the same time. So be careful, you don't want your UI
> > > Thread waiting to beginTransaction() while one of your background
> > > threads is holding it for a long time.
>
> > > On Dec 15, 2:08 pm, Miguel Morales <therevolti...@gmail.com> wrote:
>
> > > > There's also CouchDB for Android:http://www.couchone.com/android
>
> > > > On Wed, Dec 15, 2010 at 12:06 AM, Jawwad Farooq <jawwad.far...@gmail.com> wrote:
>
> > > > > While surfing I found a very very useful resource:
>
> > > > >http://tordtech.blogspot.com/search/label/Benchmarking
>
> > > > > Please have a look ......
>
> > > > > On Dec 15, 10:40 am, Jawwad Farooq <jawwad.far...@gmail.com> wrote:
> > > > >> Thanks for the link.... But I only need the benchmarks for available
> > > > >> Android databases..
>
> > > > >> Any other link??
>
> > > > >> On Dec 14, 10:00 pm, Bret Foreman <bret.fore...@gmail.com> wrote:
>
> > > > >> > Here's a list of the standard DB performance metrics:http://www.tpc.org/tpcc/
>
> > > > >> > Which ones are you interested in?
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to android-developers@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > android-developers+unsubscribe@googlegroups.com
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > --
> > > > ~ Jeremiah:9:23-24
> > > > Android 2D MMORPG:http://developingthedream.blogspot.com/,http://www.youtube.com/user/r...

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment