×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Oct 2011
    Location
    Chennai, India
    Posts
    2

    Unhappy J2ME Database Connection - Suggestion/Help

    Dear All,
    I am new to J2ME. My task is to develop a mobile application for Nokia. In that I need to save some datas in the mobile database. I do not know which database can be used. I read somewhere and tried Derby database. I can create tables in that databses.

    Now, I want to insert the data to that DB via my mobile application. Please help me with sample code. That application is stand alone.

    Its very urgent. Thanks.

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: J2ME Database Connection - Suggestion/Help

    There are three main components in this task: The midlet, the servlet and the database. You have the midlet on your phone, then a servlet running on the server that handles the front end communication with the midlet, as well as the backend communication with the database.

    You can try this example:

    http://j2mesamples.blogspot.com/2009...sing-j2me.html

    that takes the database name a username and a password and passes it on to the database that runs as a servlet throuh an http connection.

    The connection status is then returned back to the midlet.

    For details on how to implement the servlet on server's side, you can look at the apache tomcat project:
    http://tomcat.apache.org/

    Further information regarding communication between a midlet and a servlet:
    http://www.java2s.com/Code/Java/J2ME...avaservlet.htm

    Communication between a servlet and a mysql database:
    http://www.yolinux.com/TUTORIALS/Lin...cat.html#MYSQL

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: J2ME Database Connection - Suggestion/Help

    Hello prabinyovan,

    and welcome to Nokia Developer Discussion Boards!

    Could you provide more information about the scope of your requirement please?

    Like skalogir described, there are many options which could come in question when implementing databases for a Java ME application.

    Depending on your use case, you could use also the persistent storage for a MIDlet (Recordstore) or by storing data into a file by placing it into the file system of the device.

    More information on these options, please see there resources on Java Developer's Library by Nokia:

    Java Developer's Library 3.11 > Developer's guides > Application framework > Persistent storage: http://library.developer.nokia.com/i...7626043FD.html

    Java Developer's Library 3.11 > Developer's guides > Data handling: http://library.developer.nokia.com/t...2863F72CF.html

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  4. #4
    Registered User
    Join Date
    Oct 2011
    Location
    Chennai, India
    Posts
    2

    Re: J2ME Database Connection - Suggestion/Help

    Dear skalogir & r2j7

    Thanks for your response. My requirement as follows as steps,

    1. I have to download few datas from online MSSQL or mySQL databases and store it in my mobile.
    2. That data has to be modified in my mobile locally.
    3. After the modification, I have to synchronize the local DB from the mobile with online DB MSSQL or mySQL.

    Pls advise me with sample code.

    Thanks.
    Best Regards,
    Prabin.Y

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: J2ME Database Connection - Suggestion/Help

    On the mobile, you use J2ME MIDP and there you use the RecordStore API. You find those classes in the Java package javax.microedition.rms (in Javadoc). This is the easiest API because you do have have to fight with certificates or signing as you would have to with the FileConnection API.

    For the communication (on the mobile), you use the HttpsConnection API. Again, this is described in MIDP since version 2 and its package javax.microedition.io. This is easier as SocketConnection because HTTP should be well-known and some network provider (better their default settings) limit the connection to the layer of HTTP.

    For the server side (your database), you should go for another discussion board because there are zillions ways to do that. One option is to use an Apache Tomcat for which you connect to a database well-known to you. In Apache Tomcat, you are able to write Java as well, and you get an HTTP interface to communicate with.

    Or said differently, you are asking the wrong questions to this board. You were given a rather abstract work. Now, you are looking how to stick this all together. You are better off by talking about this with several of your colleagues. The questions are: Which database (on the server) is well-known to your colleagues? Is there any adapter to provide a HTTP interface, already? Alternatively, how do external devices talk your existing databases. By the way, if this is an academic project: Learn (from other students, books, tutorials) rather than to copy code.

Similar Threads

  1. Servlet On IIS For J2ME Database Connection
    By nyerunkar in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2011-06-08, 05:33
  2. Suggestion regarding j2me http request
    By kumar1234567 in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2011-06-04, 14:34
  3. Database connection in J2ME
    By nams10 in forum Mobile Java General
    Replies: 4
    Last Post: 2010-05-08, 18:29
  4. Suggestion for resolving PC suite connection via bluetooth
    By Kazi in forum Bluetooth Technology
    Replies: 0
    Last Post: 2003-03-14, 19:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×