首页 > 解决方案 > DBD::Oracle unable to connect due to OCIEnvNlsCreate error on MacOS 10.12.6

问题描述

I'm trying to connect to an Oracle server in a Perl script. The script works on other machines that are already configured. I'm trying to set up my machine to allow me to do local development.

I have extracted instantclient-basic-macos.x64-11.2.0.4.0.zip, instantclient-sqlplus-macos.x64-11.2.0.4.0.zip, instatnclient-sdk-macos.x64-11.2.0.4.0.zip, and instantclient-jdbc-macos.x64-11.2.0.4.0.zip to /usr/local/oracle_client. I have added that location to my PATH, ORACLE_HOME, LD_LIBRARY_PATH, and DYLD_LIBRARY_PATH environment variables via both .bashrc and .bash_profile in an attempt to find a fix. I have added the variables to the Perl script environment directly by setting them directly in the script:

$ENV{'ORACLE_HOME'} = '/usr/local/oracle_client';
$ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'};
$ENV{'DYLD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'};

I have reinstalled DBD::Oracle multiple times with various environment configurations. I can connect to the database using the sqlplus client installed to /usr/local/oracle_client.

Inside /usr/local/oracle_client, I have created symlinks for bin and lib pointing to the /usr/local/oracle_client dir (bin -> .). The SDK also lives inside a subdirectory structure located at /usr/local/oracle_client/sdk, but all of the include files have been copied to the /usr/local/oracle_client folder.

What am I missing?

标签: oracleperldbidbd

解决方案


推荐阅读