• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem connecting to Oracle 10g via 'Instant Client's dylibs'
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem connecting to Oracle 10g via 'Instant Client's dylibs'


  • Subject: Problem connecting to Oracle 10g via 'Instant Client's dylibs'
  • From: "Frederick C. Lee" <email@hidden>
  • Date: Sun, 21 May 2006 12:14:50 -0700

Environment: OS X (10.4.6) on G4.

I'm getting lost on how to connect an ObjC/Cocoa session/project to an Oracle database.
My question can apply to any situation where one needs to connect to a 'foreign' dynamic library.


The Setup:

1) I used 'Oracle Instant Client Installer' {http:// www.kyngchaos.com/} to install the necessary Oracle libraries here:

[/Users/oracle]ls /usr/local/oracle/lib
libclntsh.10.1.dylib* libclntsh.so@ libnnz10.dylib@ libocci.dylib. 10.1@ libocijdbc.dylib@
libclntsh.dylib@ libnnz.10.dylib* libocci.10.1.dylib* libociei.dylib* libocijdbc10.dylib@
libclntsh.dylib.10.1@ libnnz.dylib@ libocci.dylib@ libocijdbc.10.dylib*



2) I've read that LD_LIBRARY_PATH is rather "archaic" for the Mac OS X vs a directory of dylibs accessable directly from XCode.
So I set the XCode 2.2.1 Library search Path as:


USER_HEADER_SEARCH_PATHS = /usr/local/oracle/sdk/include
LIBRARY_SEARCH_PATHS = /usr/local/oracle/lib


Is this the correct approach?

==============

I've looked at a generic on-line example but don't know what I'm doing.

I saw some source-code demo on-line so I essentially cut/pasted the following code.
The following is what I've done within the NSApp's Delegate method:


3) Even though I have the SEARCH_PATH pointing to the .../include directory,
I still have to hard-code the path. Why?
...
#include "/usr/local/oracle/sdk/include/oci.h"
...


static OCIEnv *p_env;
static OCIError *p_err;
static OCISvcCtx *p_svc;
static OCIStmt *p_sql;
static OCIDefine *p_dfn = (OCIDefine *) 0;
static OCIBind *p_bnd = (OCIBind *) 0;

int p_bvi;
char p_sli[20];
int rc;
char errbuf[100];
int errcode;

@implementation AppDelegate

- (id)init {
self = [super init];

if (self) {

rc = OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, // Initialize OCI <-- crashes here.
(dvoid * (*)(dvoid *, size_t)) 0,
(dvoid * (*)(dvoid *, dvoid *, size_t))0,
(void (*)(dvoid *, dvoid *)) 0 );


// Initialize environment
rc = OCIEnvInit( (OCIEnv **) &p_env, OCI_DEFAULT, (size_t) 0, (dvoid **) 0 );


// Initialize handles:
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_err, OCI_HTYPE_ERROR,
(size_t) 0, (dvoid **) 0);
rc = OCIHandleAlloc( (dvoid *) p_env, (dvoid **) &p_svc, OCI_HTYPE_SVCCTX,
(size_t) 0, (dvoid **) 0);


}

NSLog(@"{Appdelegate} Init.");

return self;
} // end init().
...
...

==============

What I get is:
test has exited due to signal 6 (SIGABRT).
[Session started at 2006-05-20 16:01:28 -0700.]
ZeroLink: unknown symbol '_OCIInitialize'

4) Am I on the right track or what am I doing wrong?

-- Oracle/OS X neophyte.

Ric.

P.S. I've sent a query to an Oracle forum but got no answers yet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Problem connecting to Oracle 10g via 'Instant Client's dylibs'
      • From: Tom Marchand <email@hidden>
  • Prev by Date: Saving page setup accessory view settings as defaults
  • Next by Date: Re: iTunes user rating / Re: Stop NSTableColumn from being dragged, and from changing position (like iTunes)
  • Previous by thread: Re: Saving page setup accessory view settings as defaults
  • Next by thread: Re: Problem connecting to Oracle 10g via 'Instant Client's dylibs'
  • Index(es):
    • Date
    • Thread