我连接mssql 通过odbc,在linux redhat 64bit。
----> below is odbc and freetds configuration files.
------- freetds.conf--------------
[FreeTDS]
host=172.21.32.20
port=1433
tds version=7.2
client charset = GB2312
------------ odbcinst.ini-----------------
[TDS]
Description = TDS
Driver = /usr/local/lib/libtdsodbc.so
Trace = Yes
TraceFile=/tmp/odbcinst.log
UsageCount = 1
------------- odbc.ini -----------------
[SQLSERVER]
Driver = TDS
Description = sql server dsn
Trace = NO
Server = 172.21.32.20
Database = Live
Port = 1433
TDS_Version = 7.2
TraceFile=/tmp/sqlserver.log----------------------- snippets ---------------------------
QString f3ErpDsn = QString::fromLocal8Bit("Driver={SQLSERVER};server=172.21.32.20;database=Live;uid=inp;pwd=inp;");
QSqlDatabase f3ErpDb= QSqlDatabase::addDatabase("QODBC");
f3ErpDb.setDatabaseName(f3ErpDsn);
// f3ErpDb.setDatabaseName("SQLSERVER");
f3ErpDb.setUserName("inp");
f3ErpDb.setPassword("inp");
QString sqlCmdStr = "select * from dbo.Table_Drilling_Data01 where status=1";
if ( ! f3ErpDb.open() )
{
qDebug() << f3ErpDb.lastError().text();
return 1;
}
QSqlTableModel model;
model.setTable("dbo.Table_Drilling_Data01");
model.setFilter("status=3");
model.select();
qDebug() << model.lastError().text();----------------- error messages
1. "f3ErpDb.setDatabaseName(f3ErpDsn);"
当我设置setDatabaseName 为 f3ErpDsn.
错误信息是 : "QODBC3: Unable to connect", "[unixODBC][Driver Manager]Data source name not found, and no default driver specified")
我已经定义SQLSERVER在odbc.ini中,为什么他还是报错呢?2. 如果我改成 "f3ErpDb.setDatabaseName("SQLSERVER");"
error message is : "[FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown. QODBC3: Unable to execute statement"
这又是为什么呢?
thanks
ken
----> below is odbc and freetds configuration files.
------- freetds.conf--------------
[FreeTDS]
host=172.21.32.20
port=1433
tds version=7.2
client charset = GB2312
------------ odbcinst.ini-----------------
[TDS]
Description = TDS
Driver = /usr/local/lib/libtdsodbc.so
Trace = Yes
TraceFile=/tmp/odbcinst.log
UsageCount = 1
------------- odbc.ini -----------------
[SQLSERVER]
Driver = TDS
Description = sql server dsn
Trace = NO
Server = 172.21.32.20
Database = Live
Port = 1433
TDS_Version = 7.2
TraceFile=/tmp/sqlserver.log----------------------- snippets ---------------------------
QString f3ErpDsn = QString::fromLocal8Bit("Driver={SQLSERVER};server=172.21.32.20;database=Live;uid=inp;pwd=inp;");
QSqlDatabase f3ErpDb= QSqlDatabase::addDatabase("QODBC");
f3ErpDb.setDatabaseName(f3ErpDsn);
// f3ErpDb.setDatabaseName("SQLSERVER");
f3ErpDb.setUserName("inp");
f3ErpDb.setPassword("inp");
QString sqlCmdStr = "select * from dbo.Table_Drilling_Data01 where status=1";
if ( ! f3ErpDb.open() )
{
qDebug() << f3ErpDb.lastError().text();
return 1;
}
QSqlTableModel model;
model.setTable("dbo.Table_Drilling_Data01");
model.setFilter("status=3");
model.select();
qDebug() << model.lastError().text();----------------- error messages
1. "f3ErpDb.setDatabaseName(f3ErpDsn);"
当我设置setDatabaseName 为 f3ErpDsn.
错误信息是 : "QODBC3: Unable to connect", "[unixODBC][Driver Manager]Data source name not found, and no default driver specified")
我已经定义SQLSERVER在odbc.ini中,为什么他还是报错呢?2. 如果我改成 "f3ErpDb.setDatabaseName("SQLSERVER");"
error message is : "[FreeTDS][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x00 is unknown. QODBC3: Unable to execute statement"
这又是为什么呢?
thanks
ken
解决方案 »
- 求一条sql语句
- 字段合并
- 散尽分,存储过程问题,sql2000中如何用with!!
- SELECT SUBSTRING(OA_CITYCODE, 1, 2) AS TEMP FROM T_OA_CITYCODE WHERE TEMP = '33' 为什么说列名 TEMP 无效呢?
- 下面语句怎么样写呢
- 请教各位数据库高手:我表中有这样一列aa(int型)存取数据为0,1我要在客户端软件中这样显示0显示公历,1显示农历SQL怎样写?
- 查询与统计能否在一个语句里实现
- SQLServer的存储过程可以删除远程服务器上的文件吗?
- 请教:一个使用聚合函数的问题
- 我想得到列名字,存入临时表中!!!!!!!!!!!!!!!!!!!
- sqlite可以直接在内存上建表.做测试是神级的速度.请问大神sqlserver有没有相应的功能?
- SQL2000想解决Sybase里面List那样的数组问题
谁能解决这个问题啊???
[unixODBC][Driver Manager]Data source name not found, and no default driver specified