Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Android Application - Remote database connection

  • 09-12-2010 11:31pm
    #1
    Moderators, Computer Games Moderators Posts: 3,093 Mod ✭✭✭✭


    Hey, Im developing a web app with java servlets that can access an oracle database through the tomcat server. I am also developing an android app that I want to use to be able to display the information that is stored on this database.

    I am just wondering how I do this or is it even possible with oracle & tomcat? If not what other databse/server should i use? The data will also have gps coordinates to display the items on a map.

    Fairly new to this type of application

    Thanks a mill


Comments

  • Registered Users, Registered Users 2 Posts: 14,378 ✭✭✭✭jimmycrackcorm


    Use web services for the Android app to talk to tomcat which will access the database and return the data in xml.


  • Closed Accounts Posts: 1 max.


    Use web services for the Android app to talk to tomcat which will access the database and return the data in xml.

    How would this be achieved? I am in a similar situation where I require the users to login via a interface and information stored in the database to be displayed (preferably via locations on a map). Sorry to be a pain but could you explain how exactly this would work and a few of the relevant steps I would need to take to achieve this?

    Thanks!


  • Registered Users, Registered Users 2 Posts: 14,378 ✭✭✭✭jimmycrackcorm


    max. wrote: »
    How would this be achieved? I am in a similar situation where I require the users to login via a interface and information stored in the database to be displayed (preferably via locations on a map). Sorry to be a pain but could you explain how exactly this would work and a few of the relevant steps I would need to take to achieve this?

    Thanks!

    Ok responding to your pm.

    I'm going to make an assumption that what your app is trying to do is allow a user to login and then once validated it will show the user some locations on a map. I'm also assuming you're OK about connecting to Oracle and running queries on the server side.

    To make this simple as possible I'd skip the tomcat built-in authentication and just do a simple authentication yourself. Later you can update it to use the standard authentication mechanism.

    1) provide your app with a login entry page on start up that collects username / password
    2) Call a simple webservice on your tomcat server passing these. Check them against the user in the database - if they are valid credentials then simply generate a unique value that you will uses as a sessionid for other service calls. Store that sessionid against the user in the database.
    3) Your service will either return the sessionid or an invalid error to the app so you can retry the login or continue to the map screen.
    4) Once you have this sessionid you can use it as a parameter to identify the user in any other calls; in your map screen you will make a call to another web service requesting the geopoints to display. This service would return an xml array of the points that you can add to the overlay and apply to your maps display.



    To make the communication simple you could do it completely using basic http with the code from this as an example: http://lukencode.com/2010/04/27/calling-web-services-in-android-using-httpclient/

    It might be easier though to use REST services as it would mean you wouldn't have to parse the repsonse to get the objects: http://code.google.com/p/resting/


    Here's a pointer to adding overlays to maps : http://developer.android.com/resources/tutorials/views/hello-mapview.html

    Good luck and if you need any help let me know by PM.

    J.


Advertisement