Skip to main content

Pulling data in j2me

5 replies [Last post]
timonjue
Offline
Joined: 2006-12-15

Hi guys I am new in j2me and I have an application that work similar to the Java Smart Ticket sample application Ie the ability of the application to pull some data from the database on the server and populate the mobile application.
I am wondering how I will download the data from the database hosted to the mobile phone and how do I store the data in the mobile takin to considetration am using a nokia phone limited in memory.
Kindly point me to the direction

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
timonjue
Offline
Joined: 2006-12-15

I sorted out the issue am using an RMS Store locally and using a web service to update the server thanks guys

3dfan
Offline
Joined: 2009-05-21

Thanks for useful tips man, I am new at it and your advise helped a lot!

sfitzjava
Offline
Joined: 2003-06-15

Communication with a web server would be easily done using an HttpConnection, sending a request and taking the response as your data to store.
With a memory limited device, and it being a nokia I would think you might have an external memory card like a micro SD in which case you would want to use the FileConnection in the PIM support. If it doesn't have PIM support, then you will have to use RMS, and figure out how to compress the data either using binary encoding, or a GZIP type compression. (I would go with the binary encoding as the GZIP would just take more RAM which your device may also be low on).

Try looking for some answers in the M&E wiki located here:
http://wiki.java.net/bin/view/Mobileandembedded/AppDev

-Shawn

timonjue
Offline
Joined: 2006-12-15

Thanks Shawn
I was thinking in the follwong lines please advice
I have to pull the data down and store it In RMS. To do this I was looking at how I can Incorporate kXML to help me pull the data down then I will read it and store it in a RMS.
The problem is the server application ie the pages I will be accessing using http are in asp.net
I was looking to use the same design as used in the blue print example for the Ticketting system but I cannot find the application. Kindly can u dirrect me to a similar apluication or tutorials.

Theo

sfitzjava
Offline
Joined: 2003-06-15

Here is some example links:
http://www.devx.com/xml/Article/11773

http://www.roseindia.net/software-tutorials/detail/23082

Sorry to hear the server is using ASP.net, remember to check the return code, and that the response isn't an error that the sql server link is broken. I've seen that a lot going to asp.net pages and they have issues connecting to the database.

Also if you are able to specify the XML coming back try to put simple values as attributes and not as the value of the tag. Also the smaller the tag names the less bandwidth you will use.
Example:
this is the titlethis is the subheading10/13/08Some big name bloggerthis is the article

better way:

this is the subheadingthis is the article

But binary still kicks them all:
t=this is the title;d=10/13/08;a=Some big name blogger;h=this is the subheading;s=this is the article@;@
And you could make the article date field an int of 101308 which would cut that field size in half. Not to mention a Domain Specific Data requires a much smaller parser than kxml.

-Shawn