有关unixODBC:Data source name not found, and no default driver specified的问题
2016-10-11 20:06
561 查看
还是昨天测试postgresql的有关Mirroring Controller的功能时出的问题(真TM是个坑)。
首先说下环境:
在使用unixODBC连接postgresql数据库的时候报错:
The driver reported the following diagnostics whilst running [SQLDriverConnect]
IM002:1:140733193388032:[unixODBC][Driver Manager]Data source name not found, and no default driver specified
Failed to connect
非常费解,查看网上的资料,弄了好一会才搞清楚。
首先根据错误消息搜索:
http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html
查明错误原因是ODBC数据库连接字符串没找到或者ODBC默认的驱动没有装。
发生错误时我的odbc.ini配置如下
odbcinst.ini配置如下:
unixODBC自带测试链接的命令
运行后,提示:
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
我先检查了下postgresql的驱动psqlodbc有没有安装...
居然没有安装!!!
于是安装上psqlodbc,此时最新的版本是psqlodbc-09.05.0400
安装成功,默认驱动放在/usr/local/lib/psqlodbcw.so下。
安装完以后,继续测试,居然还报错!!!!
继续百度,参考下文:
http://china.ygw.blog.163.com/blog/static/687197462013418101335419/
找了半天,终于发现问题,原来是环境变量未正确配置,系统找不到配置文件。本来之前是正确的,后来我修改了unixODBC的目录名称,导致找不到了,通过执行odbcinst -j命令可以查看当前配置信息情况,以确认相关配置信息的路径是否正确。
我的配置如下:
重新配置ODBCINI及ODBCSYSINI两个环境变量即可。
其中,ODBCINI设置为odbc.ini的文件路径全名,ODBCSYSINI配置为配置文件路径,参照我的配置内容如下:
再次使用isql测试:
一切OK。
首先说下环境:
操作系统平台:RHEL6 x86_64 unixODBC版本:2.3.1
在使用unixODBC连接postgresql数据库的时候报错:
The driver reported the following diagnostics whilst running [SQLDriverConnect]
IM002:1:140733193388032:[unixODBC][Driver Manager]Data source name not found, and no default driver specified
Failed to connect
非常费解,查看网上的资料,弄了好一会才搞清楚。
首先根据错误消息搜索:
http://www.easysoft.com/developer/interfaces/odbc/sqlstate_status_return_codes.html
查明错误原因是ODBC数据库连接字符串没找到或者ODBC默认的驱动没有装。
发生错误时我的odbc.ini配置如下
[DB3] Description = SymfowareServer Driver = SymfoV12 Database = postgres Servername = {primary,standby} UserName = postgres Password = postgres Port = {26500,26501} TargetServer = primary SSLMode = verify-full SSLServerCertCN=Common ReadOnly = 0 [DB4] Description = SymfowareServer Driver = SymfoV12 Database = postgres Servername = {standby,primary} UserName = postgres Password = postgres Port = {26501,26500} TargetServer = prefer_standby SSLMode = verify-full SSLServerCertCN=Common ReadOnly = 0
odbcinst.ini配置如下:
[SymfoV12] Description = ODBC for Symfoware Open V12.1.1 #Driver = /opt/symfoclient64/odbc/lib/psqlodbcw.so # Setup = /usr/lib/libodbcpsqlS.so Driver64 = /opt/symfoclient64/odbc/lib/psqlodbcw.so Setup64 = /usr/lib64/libodbcpsqlS.so FileUsage = 1 Threading = 2
unixODBC自带测试链接的命令
isql -v DB3
运行后,提示:
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
我先检查了下postgresql的驱动psqlodbc有没有安装...
居然没有安装!!!
于是安装上psqlodbc,此时最新的版本是psqlodbc-09.05.0400
#tar zxvf psqlodbc-09.05.0400.tar.gz #cd psqlodbc-09.05.0400 #./configure --with-unixodbc --with-libpq=/usr/local/pgsql #make #make install
安装成功,默认驱动放在/usr/local/lib/psqlodbcw.so下。
安装完以后,继续测试,居然还报错!!!!
继续百度,参考下文:
http://china.ygw.blog.163.com/blog/static/687197462013418101335419/
找了半天,终于发现问题,原来是环境变量未正确配置,系统找不到配置文件。本来之前是正确的,后来我修改了unixODBC的目录名称,导致找不到了,通过执行odbcinst -j命令可以查看当前配置信息情况,以确认相关配置信息的路径是否正确。
我的配置如下:
unixODBC 2.3.1 DRIVERS............: /usr/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources USER DATA SOURCES..: /root/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8
重新配置ODBCINI及ODBCSYSINI两个环境变量即可。
其中,ODBCINI设置为odbc.ini的文件路径全名,ODBCSYSINI配置为配置文件路径,参照我的配置内容如下:
export ODBCINI=/usr/local/etc/odbc.ini export ODBCSYSINI=/usr/local/etc
再次使用isql测试:
isql -v DB3
一切OK。
相关文章推荐
- isql [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
- 遇到的问题----DBI的ODBC报错运行perl脚本时报错:[unixODBC][Driver Manager]Data source name not found, and no default
- 遇到的问题----DBI的ODBC报错运行perl脚本时报错:[unixODBC][Driver Manager]Data source name not found, and no default
- [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
- solr web服务器管理界面_错误:查询 no field name specified in query and no default specified via 'df' param
- Android积累之《Wrong orientation? No orientation specified, and the default is horizontal, yet this la:》
- No orientation specified, and the default is horizontal. This is a common source of bugs when ...
- There is no Action mapped for namespace / and action name ..问题分析
- Android积累之《Wrong orientation? No orientation specified, and the default is horizontal, yet this la:》
- No orientation specified, and the default is horizontal. This is a common source of bugs when childr
- There is no Action mapped for namespace / and action name . - [unknown location]问题
- No orientation specified, and the default is horizontal. This is a common source of bugs when childr
- 关于这个问题There is no Action mapped for namespace / and action name login.的处理
- 布局文件提示错误“No orientation specified, and the default is horizontal. This is a common so...”
- There is no Action mapped for namespace / and action name ..问题分析
- cocos2dx 编译 plugin-x 遇到的问题_tkinter.TclError: no display name and no $DISPLAY environment variable
- There is no Action mapped for namespace / and action name ..问题分析
- 布局文件提示错误“No orientation specified, and the default is horizontal. This is a common so...”
- Wrong orientation? No orientation specified, and the default is horizontal, yet this layout has mult
- android No orientation specified, and the default is horizontal.