This discussion is archived
4 Replies Latest reply: Jan 11, 2005 1:15 AM by 336258 RSS

Newbie to Oracle

436038 Newbie
Currently Being Moderated
My company recently installed an Oracle database and I'm trying to get my existing applications---written in both C and Applescript---to talk with it.

Being a complete newbie to Oracle and databases in general, I was wondering if someone could point me in the right direction. What would be the best way for me to talk with Oracle? If I were to start learning anything, should it be Java? SQL?

Also, I built my apps in Xcode and I'm trying to avoid starting over from scratch. Is there a way to keep my existing code and still talk with Oracle?

Thanks.

Brad
  • 1. Re: Newbie to Oracle
    RonaldRood Oracle ACE
    Currently Being Moderated
    My company recently installed an Oracle database and
    I'm trying to get my existing applications---written
    in both C and Applescript---to talk with it.

    anything, should it be Java? SQL?
    Hi Brad,
    does you app use sql ? In that case the easiest will be to use jdbc to connect to the database. If it's not using sql I am afraid you are out of luck. I am no developer so I might miss something but I sure know about oracle databases.

    regards,
    Ronald
    http://homepage.mac.com/ik_zelf/oracle
  • 2. Re: Newbie to Oracle
    431839 Newbie
    Currently Being Moderated
    Hi!

    I started out three years ago, developing an application in Objective-C and Xcode (it wasn't Xcode at that time) that was to talk to our existing Oracle installation. To be able to talk to Oracle, I made a small Java object, that connects via JDBC to the Oracle. All the rest of the code is in Objective-C.

    If you want to follow that approach, and want to know more about how I did it, contact me: ivan at myrvold.org
  • 3. Re: Newbie to Oracle
    435428 Newbie
    Currently Being Moderated
    string ls_objectname,ls_curcol,ls_addpic
    integer li_pic_x,li_pic_y
    long ll_row,ll_Index,ll_firstrow,ll_lastrow,ll_temp
    ls_objectname = string(dwo.name) //¶ÔÏóÃû³Æ
    if dwo.type <> 'text' and dwo.name <> 'datawindow' and row > 0 then
    this.selectrow(0,false)
    this.selectrow(row,true)
    end if
    if row = 0 and this.describe(ls_objectname+".band") = "header" and this.describe(ls_objectname + ".text") <> "!" then //ÊÇ·ñµã»÷ÁжÔÏó
         ls_curcol = left(ls_objectname,len(ls_objectname) - 2) //µ±Ç°ÁжÔÏóÃû³Æ
         if ls_curcol <> is_oldcol then //µã»÷µÄÊDz»Í¬ÁжÔÏó
         this.modify(is_objectname + ".color =" + string(rgb(0,0,0)))
         this.modify(ls_objectname + ".color =" + string(rgb(255,0,0)))
              is_oldcol = ls_curcol //±£´æÉϴεã»÷µÄÁжÔÏó
              is_objectname = ls_objectname
              this.setsort(ls_curcol +" A") //Í·Ò»´Îµã»÷µ±È»ÊÇÉýÐòÁË
              this.sort()
         else //µ±Ç°ÁÐÒѾµã¹ýÁË
    ib_accend = not ib_accend
              if ib_accend then //ÉÏ´ÎÊÇÉýÐò
                   this.setsort(ls_curcol + " D") //Õâ´ÎÊǽµÐò
              else
                   this.setsort(ls_curcol + " A")
              end if
              this.sort()
         end if
    end if
    return 0

  • 4. Re: Newbie to Oracle
    336258 Newbie
    Currently Being Moderated
    Hello

    If you are not familiar with ORACLE, my own little advice will be to start with downloading and reading Oracle 10g developer's guide(s) which are available from the OTN site. I found those guides really well written: they will provide you with the most knowledgeable introduction to Oracle features.

    Further, if you are familiar with Cocoa programming, you may wish to download and read Oracle OCI (aka Oracle call interface) reference manual(s) from the same documentation site. OCI is a set of C functions that allow you to do almost anything on an Oracle database. All those C functions are compatible with the Cocoa Objective C environment, provided you set up quite a number of parameters.

    From my own experience, here is a list of what may need to be done to compile a Cocoa program with Oracle OCI functions. (in all lines below replace $<Something> with the full name)
    - On your project "customized settings", initialize the header paths to point to ORACLE header directories. There are three directories: $ORACLE_HOME/rdbms/demo, $ORACLE_HOME/rdbms/public, $ORACLE_HOME/plsql/public. Write the full paths (again, expand your $ORACLE_HOME ) separated by spaces.
    - Idem with the Library search paths: $ORACLE_HOME/lib $ORACLE_HOME/rdbms/lib
    - In the "Other Linker flags" add: -lclntsh
    - You may also wish to unset the "Zero link" and the "Prebinding" flags

    In a file that call an OCI function, add the three lines
    #ifndef OCI_ORACLE
    #include <oci.h>
    #endif

    (oci.h includes many other files, that is what you need to declare the above three header paths).
    Your program should compile with no errors. You may encounter several warnings related to multiple definitions of SSL functions (it will make no harm as long as you do not use them in your program).

    Finally, if you want to run your program (within or outside the XCode environment) you need to initialize a few environment variables, the most important being DYLD_LIBRARY_PATH, to point to both $ORACLE_HOME/lib and $ORACLE_HOME/rdbms/lib. You may also wish to initialize $ORACLE_HOME and $ORACLE_SID.
    As you know, DYLD_LIBRARY_PATH is Apple's own definition for the usual UNIX LD_LIBRARY_PATH, which points to shared libraries.
    To initialize those variables, I follow Apple's advice on session-wide environment variables: on your $HOME directory, create a .MacOSX ( yes: "dotMacOSX") hidden directory and add an "environment.plist" property file filled with those variables to it. Then restart your session to take the parameters into account. This is enough in a development environment.

    I hope this may be useful to you. Good luck and again, read ORACLE documentation first: it is definitively not a waste of time!

    G. Brefort
    Sanofi-Aventis