isql [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified


ndyMacBookPro:etc andy$ isql -v TEST1dsn root root
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
AndyMacBookPro:etc andy$ isql -v andy1 root root
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select top 1 * from shopname;
+------------+---------------------------------------------------+------------+
| id         | shopname                                          | shopid     |
+------------+---------------------------------------------------+------------+
| 486        |                                                   | 906        |
+------------+---------------------------------------------------+------------+
SQLRowCount returns 1
1 rows fetched
SQL> 



改了一下配置,突然就好了,我只能把我的配置放在这里:


/usr/local/etc/freetds.conf

/usr/local/etc/odbcinst.ini

/usr/local/etc/odbc.ini


其中freetds.conf中配置:

# A typical Microsoft server
[TEST1dsn]
        host = some sql server host like 192.168.100.9
        port = 1433
        tds version = 7.0



odbcinst.ini中配置:


[FreeTDS]
Description=freetds driver
Driver=/usr/local/lib/libtdsodbc.so



odbc.ini中配置:


[andy1]
Driver=FreeTDS
Description=MSSQL Server
Servername=TEST1dsn
Database=dbtest



现在在thinkphp中的config.php中配置:


$array = array(

'DB_TYPE' => 'pdo',
'DB_DSN' => 'odbc:andy1',
'DB_NAME' => 'testdb',
'DB_USER' => 'root',
'DB_PWD' => 'root',
'DB_PREFIX' => '',

);
return $array;
?>


已经可以正常访问数据库了~~~


你可能感兴趣的:(isql [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified)