简体   繁体   English

odbc_connect(): SQL 错误: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect

[英]odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect

I am getting error我收到错误

odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect for Linux server odbc_connect(): SQL 错误: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect for Linux server

while executing following command to connect with sybase from PHP.在执行以下命令以从 PHP 连接 sybase 时。

$db = ADONewConnection('odbc');

$DSN = 'UID=username;PWD=password;EngineName=dbServiceName;AutoStop=No;Integrated=No;Debug=No;DisableMultiRowFetch=No;CommLinks=SharedMemory,TCPIP{};Compress=No;Driver={Adaptive Server Anywhere 9.0}';


$db->Connect($DSN );

I have installed ODBC drivers with FreeTDS to connect Sybase database with PHP code with following commands我已经使用 FreeTDS 安装了 ODBC 驱动程序,以使用以下命令将 Sybase 数据库与 PHP 代码连接起来

  • sudo apt-get install unixodbc sudo apt-get install unixodbc
  • sudo apt-get install tdsodbc sudo apt-get install tdsodbc
  • sudo apt-get install freetds-bin tdsodbc sudo apt-get install freetds-bin tdsodbc

/etc/odbc.ini file /etc/odbc.ini文件

  • Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so驱动程序 = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
  • Setup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so设置 = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
  • Server = server_name服务器 = server_name
  • Port = port_number端口 = 端口号
  • Database = dbname数据库 = 数据库名称
  • Username = dbusername用户名 = 数据库用户名
  • Password = dbpassword密码 = 数据库密码

freetds.conf file freetds.conf文件

[sybase]
    host=
    port=
    Tds version=

If you're using FreeTDS, you need to specify the driver from odbcinst.ini , which is normally FreeTDS.如果您使用的是 FreeTDS,则需要从odbcinst.ini指定驱动程序,通常是 FreeTDS。 Try:尝试:

$DSN = 'UID=username;PWD=password;EngineName=dbServiceName;AutoStop=No;Integrated=No;Debug=No;DisableMultiRowFetch=No;CommLinks=SharedMemory,TCPIP{};Compress=No;Driver={FreeTDS}';

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 odbc_connect():SQL错误:[unixODBC] [驱动程序管理器]数据源 - odbc_connect(): SQL error: [unixODBC][Driver Manager]Data source 警告:odbc_connect():SQL 错误:[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序 - Warning: odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified SQL错误:未找到数据源名称且未指定默认驱动程序 - SQL error: Data source name not found and no default driver specified PHP 警告:odbc_connect():SQL 错误:[unixODBC][Driver Manager]无法打开 lib。 在 php 中连接到 Snowflake 不起作用,但 isql 连接是 - PHP Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib. Connection to Snowflake in php is not working but isql connection is PHP + odbc:找不到数据源名称,并且未指定默认驱动程序 - PHP + odbc: Data source name not found and no default driver specified PDO_ODBC:找不到数据源名称,并且未指定默认驱动程序 - PDO_ODBC: Data source name not found and no default driver specified 使用PHP-SQL状态IM002的Sage 50 ODBC - Sage 50 ODBC using PHP-SQL state IM002 sqlsrv_connect:未找到数据源名称且未指定默认驱动程序 - sqlsrv_connect: Data source name not found and no default driver specified sqlsrv_connect:找不到数据源名称,并且未指定默认驱动程序 - sqlsrv_connect: Data source name not found and no default driver specified odbc_connect中的SQL_CUR_USE_DRIVER是什么? - What is SQL_CUR_USE_DRIVER in odbc_connect?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM