Re: Problem connecting to Oracle with app run from XCode
Re: Problem connecting to Oracle with app run from XCode
- Subject: Re: Problem connecting to Oracle with app run from XCode
- From: Timothy Mowlem <email@hidden>
- Date: Thu, 7 Oct 2010 19:47:33 +0100
Hello Greg,
> Greg Guerin wrote:
>> Timothy Mowlem wrote:
>>
>> I can run the XCode built app as well from the command line after
>> setting LD_LIBRARY_PATH (as a non-admin user and without using sudo).
> If that env-var is the cause, then printf() the value of it in both
> cases, and manually compare them. Use the getenv() C function.
>
> You might also read the Mac OS X man page for 'dyld', if you haven't
> done so yet.
> Xcode > Help > Open man Page...
>
> -- GG
Thanks for the input. I might have been slightly misleading but I think LD_LIBRARY_PATH is fine. For a while I was getting a link error at runtime until I read the XCode documentation and found the correct place to set the env var to run it within XCode, by selecting the executable under the Executables group, choosing GetInfo and adding the env var under the environment area of the Arguments tab.
I confirmed that it is finding and using the library using printfs thus:
printf ("--> A\n");
OCI_Connection* cn;
OCI_Statement* st;
OCI_Resultset* rs;
if (!OCI_Initialize (NULL, NULL, OCI_ENV_CONTEXT))
{
OCI_Error *error = OCI_GetLastError();
printf ("--> Initialize failed: code = %d, msg = %s\n", OCI_ErrorGetOCICode (error), OCI_ErrorGetString (error));
OCI_Cleanup();
return;
}
printf ("--> B\n");
cn = OCI_ConnectionCreate ("xe", "ddi", "kitty", OCI_SESSION_DEFAULT);
if (cn == NULL)
{
OCI_Error *error = OCI_GetLastError();
printf ("--> Create connection failed: code = %d, msg = %s\n", OCI_ErrorGetOCICode (error), OCI_ErrorGetString (error));
OCI_Cleanup();
return;
}
I see A and B on the console followed after a delay (network timeout) by the error message ORA-12170: TNS:Connect timeout occurred
Running the app on the console it works immediately. So I think that for some reason the app run from within XCode does not have permission to access the network connection. I have checked that all firewalls, etc are off and I still get the same behaviour.
I am logged in as a normal user and not an admin user. I will see what Wireshark shows me but any ideas would be appreciated.
Regards,
Tim Mowlem_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden