Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

From Midlet to Database - the missing link

 
Jack Davis
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm developing a j2me application. I want to send information inserted into a set of textfileds in a MIDlet to a table in a database. I have already developed the MIDlet graphically i.e. without the necessary connection code. I don't know what the next step is. I've done a lot of research about servlets, but most of it seems to involve web browsers and HTML - whihch I won't be using. I have tomcat runing succesfuly and mysql installed correctly. So I would appreciate if anyone could advise me what I require to update a table in the database from entries made into a MIDlet. Thanks!
 
Christian Wolf
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
So I would appreciate if anyone could advise me what I require to update a table in the database from entries made into a MIDlet.
You want to send data from the MIDlet to a server application, e.g. a servlet. You have to use HttpConnection to connect to the servlet. You use the POST method that is also commonly used when sending data in a form shown in a web browser. If you just need to send some strings, you can use the content-type "application/x-www-form-urlencoded". You have then to format the message in the body as following :
var1=value1[&var2=value2[&var3=value3[..]]]
The Sun Wireless Tool Kit 2 comes with the MIDP API documentation. Look at javax.microedition.io.HttpConnection for an example how an HTTP request is sent.
Christian Wolf
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic