I have the MS SQL Server 9.0.4035 on Windows machine. I'm connecting to it using stable freetds 0.91 and unixODBC 2.2 on my OpenSUSE 12.3. Here is the confs:
freetds.conf:
...
[egServer70K]
host = 192.168.16.37
instance = [my_instance]
port = 1435
tds version = 8.0
client charset = UTF-8
...
odbc.ini :
[msdsn]
Driver = FreeTDS
Description = MSSQL database for ay
Servername=egServer70K
Executing next sql query in tsql and isql I getting:
tsql -S egServer70K -U [login]
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> SELECT TOP(3) guid FROM [table_name] ORDER BY data_time;
2> go
guid
9A2911A6-ADE1-4AE0-B7FC-A93F7821BB1D
E2C0797E-057C-4C0E-8562-62D020C5F49C
13143608-B52B-4DBF-B571-0AD21592BABA
(3 rows affected)
(this means that on the level of freetds everithing's fine.)
And the same I got when I'm doing this:
isql -v msdsn [login] [pass]
SQL> SELECT TOP(3) guid FROM [table_name] ORDER BY data_time;
+-------------------------------------+
| guid |
+-------------------------------------+
| 9A2911A6-ADE1-4AE0-B7FC-A93F7821BB1D|
| E2C0797E-057C-4C0E-8562-62D020C5F49C|
| 13143608-B52B-4DBF-B571-0AD21592BABA|
+-------------------------------------+
SQLRowCount returns 3
3 rows fetched
(this means that on the level of the unixODBC all is ok).
But executing this lines of code in Qt 4.8.4:
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName("192.168.16.37");
db.setDatabaseName("msdsn");
db.setUserName("...");
db.setPassword("...");
QSqlQuery q( db);
q.exec(
"SELECT TOP(3) guid FROM [table_name] ORDER BY data_time;");
while( q.next()) {
qDebug() << q.value(0);
}
I got only:
QVariant(QString, "")
QVariant(QString, "")
QVariant(QString, "")
What should I do?
PS> I can't use Qt 5.