We are trying to port a simple piece of Qt 4.8.5 C++ code that runs on Ubuntu 14.04.5 and successfully uses UnixODBC 2.2.14 and FreeTDS 0.91 to execute a single SELECT statement on a MSSQL database to do the same thing on a Sybase database.
We are currently greeted with an error stating [unixODBC][Driver Manager]Function sequence error.
Our config looks like this:
/etc/odbc.ini
[myapp-odbc]
Database=variansystem
Description=MS SQL Server for MyApp connections
Driver=FreeTDS
ReadOnly=Yes
Servername=myapp-freetds
Trace=No
/etc/freetds/freetds.conf
[global]
client charset = UTF-8
tds version = 8.0
[myapp-freetds]
client charset = UTF-8
host = 192.168.0.5
port = 5000
tds version = 5.0
C++ pseudo code
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "MyConn");
db.setUserName("user");
db.setPassword("pass");
db.setDatabaseName("myapp-odbc");
if (!db.open()) return;
QSqlQuery query(db);
query.prepare("SELECT table1.col1, table1.col2, table1.col3, table2.col4, table3.col5 " +
"FROM table1 " +
"JOIN table2 ON table1.col2 = table2.col4 " +
"JOIN table3 ON table1.col3 = table3.col5 " +
"WHERE table1.col1 > :limit1 " +
"ORDER BY table1.col1;");
query.bindValue(":limit1", 123);
if (!query.exec())
{
qDebug() << query.lastError().text(); // "[unixODBC][Driver Manager]Function sequence error"
return;
}
Not owning the Sybase nor the Ubuntu server, our options on debugging are limited to things we can add to the C++ code.