Thread: oracle database connection

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    12

    Question oracle database connection

    Hi, I have been doing some investigation to connecting an Oracle 8.1 database with a C application. I've installed cygwin with gcc3.3.1 and want to use OCI to connect to my local Oracle database on a Windows 2000 machine.

    Unfortunately, I'm having some trouble compiling the sample programs that come with oracle installation:

    gcc oci02.c -I c:/oracle/ora81/oci/include -o oci02

    The errors are:
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x26f):oci02.c: undefined reference to `_oopen'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x2b8):oci02.c: undefined reference to `_oparse'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x328):oci02.c: undefined reference to `_obndrn'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x3a8):oci02.c: undefined reference to `_odefin'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x428):oci02.c: undefined reference to `_odefin'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x4a8):oci02.c: undefined reference to `_odefin'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x51d):oci02.c: undefined reference to `_oexec'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x559):oci02.c: undefined reference to `_ofetch'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x6ed):oci02.c: undefined reference to `_oerhms'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x890):oci02.c: undefined reference to `_olog'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x8fb):oci02.c: undefined reference to `_oclose'
    /cygdrive/c/DOCUME~1/ADMIN/LOCALS~1/Temp/ccDmHAES.o(.text+0x92f):oci02.c: undefined reference to `_ologof'
    collect2: ld returned 1 exit status

    I'm not sure if I'm going down the correct path to connect C with Oracle. I want to ask anyone with experience for some advice on Oracle database connection in C.

    Thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    It looks like it can't find the library

    There are two command line options

    -L/path/to/library       & nbsp;   - this tells the linker where to look
    -lfoo       &nbs p;                &nbsp ;- this tells the linker to look for libfoo.a

    The full pathname for the above library would be
    /path/to/library/libfoo.a
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Oracle database programming
    By enhancedmode in forum C++ Programming
    Replies: 1
    Last Post: 11-15-2004, 03:46 PM
  2. Database connection...
    By MipZhaP in forum Windows Programming
    Replies: 3
    Last Post: 09-11-2004, 08:36 AM
  3. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  4. How to connect with Oracle database
    By Jone in forum C++ Programming
    Replies: 1
    Last Post: 10-02-2002, 06:09 AM
  5. connection to database through c++
    By teja22 in forum C++ Programming
    Replies: 1
    Last Post: 10-15-2001, 04:10 AM