How can I connect my iPhone app to Oracle DB

Discussion in 'iOS Programming' started by jnonthanawong, Sep 15, 2010.

  1. jnonthanawong macrumors newbie

    Joined:
    Sep 15, 2010
    #1
    Hi, I'm very new to iPhone development and I have been googling for many day to know how can my iPhone application access to the Oracle database.
    I have got main two results to done this;

    1. Direct access to Oracle DB - which I have no idea how to do this?
    2. Create a web server such as JDBC to be place between iPhone and Oracle DB so what I have to do is only with web server - again I have no idea.
    (plz correct me if I'm wrong)

    until now I still dont get a clear picture of these and which way should I use and why?
    thx in advance!!
     
  2. adrian.oconnor macrumors 6502

    Joined:
    Jan 16, 2008
    Location:
    Nottingham, England
    #2
    Oracle provide a static C library, and I'm sure there's an OS X version (not 100% sure though). It might just about be possible to get it working on an iOS device, but I am quite a competent programmer and I certainly wouldn't relish the thought of doing it that way. I'd recommend you don't go down that route.

    Your second approach is much more realistic.

    I've created several iOS apps that talk to Ruby on Rails applications to save/load the data. If you create Restful resources for each of the entities you want to send over the wire, you can use the magnificent HTTPRiot library to work with the data on the iOS device.

    I've also build iOS apps that talk to Java and .NET web services, using NSURLRequest to do the data transfer work.

    Anyway, in my opinion, this is what you should try and use: http://labratrevenge.com/httpriot/docs/
     
  3. jnonthanawong thread starter macrumors newbie

    Joined:
    Sep 15, 2010
    #3
    Thank a ton! adrian.oconnor

    Do I understand this correctly,

    Direct access is possible but you not recommended, I also read through that also but never get a clue why? Can you give me a reason not to doing that?

    Web service should be my solution right! and which language will you recommend, again do I understand this correct;
    My iOS app sending GET,POST to Web Service, and it pass to the DB then the resource back in reverse. I would like to know what have been send from iOS, Web Service and Oracle DB.

    for HTTPRiot isn't this way is direct? like you put this in iOS source code to connect to DB?

    Do apologize that I ask a lot but if it possible thank in advance.
     
  4. adrian.oconnor macrumors 6502

    Joined:
    Jan 16, 2008
    Location:
    Nottingham, England
    #4
    Hi jnonthanawong,

    Direct access to Oracle is going to be very difficult and probably impossible. I don't think Oracle provide a library that will work on iPhone and I can't find an open source alternative. Even OCILIB still needs the Oracle client DLL, and that won't work on iPhone.

    You are correct about how to use the web service -- you will send and receive data using GET and POST, and your web application will connect to Oracle. You can use either XML or JSON to send the data between iOS and the web application.

    HTTPRiot is a library that will GET and POST data using JSON. It does not do direct access. You will still need a web application.

    Do you have experience of programming direct access to Oracle from either Java or .NET? If so, that it what you should use for your web application. If not, you should find somebody who does know how to and get them to help you.
     

Share This Page