Linux 无法加载 ODBC 库指定的驱动程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10383822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ODBC lib Specified driver could not be loaded
提问by TheFrack
I am trying to install ODBC drivers and I am running into brick walls.
我正在尝试安装 ODBC 驱动程序,但遇到了砖墙。
[root@Crux pkg]# isql -v
[IM002][DataDirect][ODBC lib] Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect
[root@Crux pkg]# isql -3 SUBS2A
[IM003][DataDirect][ODBC lib] Specified driver could not be loaded
[ISQL]ERROR: Could not SQLConnect
My INI files are as follows;
我的 INI 文件如下;
odbcinst.ini
odbcinst.ini
[ProgressOpenEdge]
Description = ODBC for Progress OpenEdge
Driver = /usr/dlc/odbc/lib/pgoe1023.so
;Setup = /usr/dlc/odbc/lib/pgoe1023.so
FileUsage = 1
odbc.ini
数据库配置文件
[SUBS2A]
Driver = ProgressOpenEdge
Description = Fail
DatabaseName = SUBS
PortNumber = 4000
HostName = 192.168.1.2
LogonID = SYSPROGRESS
Password = SYSPROGRESS
APILevel = 1
ConnectFunctions = YYN
CPTimeout = 60
DriverODBCVer = 03.50
FileUsage = 0
SQLLevel = 0
UsageCount = 1
ArraySize = 50
DefaultLongDataBuffLen = 2048
DefaultIsolationLevel = REPEATABLE READ
StaticCursorLongColBuffLen = 4096
[ODBC]
InstallDir = /usr/dlc/odbc
Trace = 0
TraceFile = odbctrace.out
TraceDll = /usr/dlc/odbc/lib/odbctrac.so
UseCursorLib = 0
I have already made sure all dependencies are loaded properly via ldd.
我已经确保通过 ldd 正确加载了所有依赖项。
UPDATE
更新
OUTPUT OF: strace isql -v http://pastebin.com/tXFY4vVt
输出:strace isql -v http://pastebin.com/tXFY4vVt
OUTPUT OF: strace isql -3 SUBS2A http://pastebin.com/Yu5e54mR
输出:strace isql -3 SUBS2A http://pastebin.com/Yu5e54mR
OUTPUT OF: /tmp/odbctrace.out http://pastebin.com/0kgvNdWv
输出:/tmp/odbctrace.out http://pastebin.com/0kgvNdWv
Thanks
谢谢
采纳答案by Yves Martin
You should check that your ODBC driver is loadable:
您应该检查您的 ODBC 驱动程序是否可加载:
ldd /usr/dlc/odbc/lib/pgoe1023.so
Probably the loader fails to find dependencies as shared objects(solibraries) that are not available yet in your environment or available in different version.
加载程序可能无法找到作为共享对象(因此是库)的依赖项,这些依赖项在您的环境中尚不可用或在不同版本中可用。
I recommend you add /usr/dlc/odbc/lib/
or maybe other paths according to your system:
我建议您/usr/dlc/odbc/lib/
根据您的系统添加或其他路径:
- either in the environment variable
LD_LIBRARY_PATH
- either add a specific file for linux loader, for instance
/etc/ld.so.conf.d/odbc-pgoe.conf
with the line/usr/dlc/odbc/lib/
and refresh withldconfig
(best option)
- 要么在环境变量中
LD_LIBRARY_PATH
- 要么为 linux 加载器添加一个特定的文件,例如
/etc/ld.so.conf.d/odbc-pgoe.conf
使用该行/usr/dlc/odbc/lib/
并刷新ldconfig
(最佳选择)
Please report the ldd
command output if problem persists. Maybe expected libraries file names do not match exactly your Linux distribution.
ldd
如果问题仍然存在,请报告命令输出。也许预期的库文件名与您的 Linux 发行版不完全匹配。
Update :The last comment of this postconfirms that a ld.so.conf file is a solution to get the driver working. You should test it.
更新:这篇文章的最后一条评论确认 ld.so.conf 文件是使驱动程序正常工作的解决方案。你应该测试一下。
This forum refers to a similar situation. Maybe the solution will fix your issue.
这个论坛提到了类似的情况。也许解决方案可以解决您的问题。
If still wrong, please report the output of strace isql -3 SUBS2A
. You will probably get a clue there of what is wrong like a failed library loading, a file access permission issue or whatever, just before the error message is written.
如果仍然错误,请报告strace isql -3 SUBS2A
. 在写入错误消息之前,您可能会在那里得到一些错误的线索,例如库加载失败、文件访问权限问题或其他任何问题。
回答by wuliang
(1) You can check whether the driver is correct before using it.
(1) 使用前可以检查驱动是否正确。
$ ivtestlib /usr/dlc/odbc/lib/pgoe1023.so
(2) Watching the log when loading drivers In a console,
(2) 在控制台加载驱动时查看日志,
tail -f /path/to/SysLog_OrOtherName.file
In another console,
在另一个控制台中,
odbc.sh