我正在尝试连接到外部普及数据库。当我登录到服务器(CentOS 7)并连接到远程服务器时,一切正常,并且可以连接。
我有几个连接和检索数据的perl脚本。当我从命令行运行此程序时,它们毫无问题地连接(无论我以哪个用户身份运行)
但是,当它们通过CRON运行时,出现以下错误:
DBI connect('*REMOVED*','',...) failed: [unixODBC][Driver Manager]Can't open lib '/usr/local/psql/lib64/libodbcci.so' : file not found (SQL-01000)
同样,如果我从命令行运行perl脚本,则不会收到错误消息。如果使用ISQL,我也可以连接到服务器。
如果我尝试以用户身份运行该命令,它也会失败,但是如果我以该用户身份登录,它将运行正常。
/* This works */
su psql
isql -v remote
/* This fails */
sudo -u psql isql -v remote
更多信息
ldd -v /usr/local/psql/lib64/libodbcci.so
linux-vdso.so.1 => (0x00007ffd317b8000)
libpscore.so.13 => /usr/local/psql/lib64/libpscore.so.13 (0x00007f107fe61000)
libpscl.so.13 => /usr/local/psql/lib64/libpscl.so.13 (0x00007f107fac3000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f107f8be000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f107f6a2000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f107f49e000)
libstdc++.so.6 => /usr/local/psql/lib64/libstdc++.so.6 (0x00007f107f16a000)
libm.so.6 => /lib64/libm.so.6 (0x00007f107ee68000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f107ec52000)
libc.so.6 => /lib64/libc.so.6 (0x00007f107e885000)
/lib64/ld-linux-x86-64.so.2 (0x00007f1080610000)
Version information:
/usr/local/psql/lib64/libodbcci.so:
libgcc_s.so.1 (GCC_3.0) => /lib64/libgcc_s.so.1
libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
libpscl.so.13 (PSCOMMON__) => /usr/local/psql/lib64/libpscl.so.13
libpscl.so.13 (PSCL) => /usr/local/psql/lib64/libpscl.so.13
libpscl.so.13 (PSCL_) => /usr/local/psql/lib64/libpscl.so.13
libc.so.6 (GLIBC_2.7) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
libpscore.so.13 (PSCORE) => /usr/local/psql/lib64/libpscore.so.13
libstdc++.so.6 (CXXABI_1.3.1) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (CXXABI_1.3) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/local/psql/lib64/libstdc++.so.6
libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
libpthread.so.0 (GLIBC_2.3.2) => /lib64/libpthread.so.0
/usr/local/psql/lib64/libpscore.so.13:
libgcc_s.so.1 (GCC_3.0) => /lib64/libgcc_s.so.1
libuuid.so.1 (UUID_1.0) => /lib64/libuuid.so.1
libdl.so.2 (GLIBC_2.2.5) => /lib64/libdl.so.2
libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
libstdc++.so.6 (GLIBCXX_3.4.20) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.11) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.9) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (CXXABI_1.3) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.21) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/local/psql/lib64/libstdc++.so.6
libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
libpthread.so.0 (GLIBC_2.3.2) => /lib64/libpthread.so.0
libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
/usr/local/psql/lib64/libpscl.so.13:
libgcc_s.so.1 (GCC_3.0) => /lib64/libgcc_s.so.1
libpthread.so.0 (GLIBC_2.2.5) => /lib64/libpthread.so.0
libpscore.so.13 (PSCORE) => /usr/local/psql/lib64/libpscore.so.13
libstdc++.so.6 (GLIBCXX_3.4.9) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.20) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (CXXABI_1.3) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.15) => /usr/local/psql/lib64/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/local/psql/lib64/libstdc++.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libuuid.so.1:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libpthread.so.0:
ld-linux-x86-64.so.2 (GLIBC_2.2.5) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libdl.so.2:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/usr/local/psql/lib64/libstdc++.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
libm.so.6 (GLIBC_2.2.5) => /lib64/libm.so.6
libgcc_s.so.1 (GCC_4.2.0) => /lib64/libgcc_s.so.1
libgcc_s.so.1 (GCC_3.3) => /lib64/libgcc_s.so.1
libgcc_s.so.1 (GCC_3.0) => /lib64/libgcc_s.so.1
libc.so.6 (GLIBC_2.3) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libm.so.6:
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib64/libc.so.6
/lib64/libgcc_s.so.1:
libc.so.6 (GLIBC_2.14) => /lib64/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib64/libc.so.6
/lib64/libc.so.6:
ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2
ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2