Sunday, May 23, 2010

Re: [android-developers] Connection is broken error when try to connect to remote HSQLDB web database

Mark,

I have to say that up until now I have had much success using JDBC and
Android. I know many who would disagree with your preference for REST
web services, however, I think that is an academic argument.

The fact is that I am using a legal Java statement to load a JDBC
driver and Android/Dalvik return a confusing error message. I am not
explicitly creating a 1-billion-element array. So what is trying to
create such a large array and where is the error message coming from?

Secondly I understand that each JVM instance has a 16 MB limit. My app
says that it is using 5 MB and that there is 1.35 MB left. So what
would be using the other almost 10 MB in my JVM instance? How do I
get/use more of it?

Kind regards,

Tim.

Mark Murphy wrote:
> Tim wrote:
> > I am trying to connect from an Android device to a remote HSQLDB web
> > database server using:
> >
> > DriverManager.getConnection("jdbc:hsqldb:http://
> > remoteserveripaddress:port","user","pwd")
> >
> > But in logcat I get errors:
> >
> > Rejecting allocation of 1011373133-element array
> > java.sql.SQLException: Connection is broken: java.lang.InternalError:
> > array size too large
> >
> > Before trying to connect I do a System.gc()
> > My FreeMemory is 1355832, MaxMemory is 16777216, TotalMemory is
> > 5185504
> >
> > Have I run out of memory?
> > How do I release more memory?
> >
> > Any ideas greatly appreciated.
>
> You are not going to be able to allocate a 1-billion-element array. To
> put that in perspective, that's 4GB, if every element is only 4 bytes.
>
> I suggest that you write a REST Web service and access your remote SQL
> database using it. I do not recommend JDBC on mobile platforms for
> access to remote databases.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android App Developer Books: http://commonsware.com/books
>
> --
> 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

--
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