Important: Please read the Qt Code of Conduct -

can not load build with unixODBC

  • hi
    every one,
    I need to connect mssqlserver,then I find a way by using unixODBC and freetds.
    I installed qt4.8.7 on my ubuntu.
    frist I dowload qt-ererywhere-opensource-src-4.7.8 and unixODBC-2.3.2. then I enter unixODBC directory,execute

    "./configure --prefix=/usr/local/unixODBC",

    no error found .
    Next I enter "~/qt-everywhere-opensource-src-4.7.8/src/plugins/sqldrivers/odbc",execute

    qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
    make ,
    make install,

    no error found the same, and /usr/lib/i386-linux-gnu/qt4/plugins/sqldrivers/ generated. but when I try to load load the odbc in my library with code below:
    QStringList strList = QSqlDatabase::drivers();

    only ("QSQLITE") was printed.
    and if I build the odbc without lodbc,just

    qmake "INCLUDEPATH+=/usr/local/unixODBC/include"

    ("QSQLITE","QOBDC3","QODBC") was print,
    when I try to open the QSqlDatabase,error print below

    symbol lookup error: /usr/lib/i386-linux-gnu/qt4/plugins/sqldrivers/ undefined symbol: SQLAllocHandle

    I am stuck here for two days ,Is any body can help me ,thanks.

  • Hi, I think you need to rebuild with that -lodbc switch, for example see here

  • @hskoglund
    I had try this by add option to qmake
    qmake "INCLUDEPATH+=/usr/local/unixODBC/include" "LIBS+=-L/usr/local/unixODBC/lib -lodbc"
    by this way , QSqlDatabase::drivers() can not find "QODBC",only "QSQLITE" is Found.

Log in to reply