Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQL server connections on Linux
QtWS25 Last Chance

SQL server connections on Linux

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    antonio
    wrote on last edited by
    #1

    Hi,

    I've worked with sql server on Windows without problems, but I try to use the same code with linux, I can't make connections.

    There are special configurations or additional libraries to make it work?

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Where's your sql server located ? How do you access it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • hskoglundH Online
        hskoglundH Online
        hskoglund
        wrote on last edited by
        #3

        It is possible to do in Qt, but not as simple as on Windows :-)

        FIrst problem is for some reason the Qt dll for ODBC is not included on Linux, i.e. there is no ~/Qt/5.2.1/gcc_64/plugins/sqldrivers/libqsqlodbc.so

        This means you have to download Qt and compile it for yourself, I did it last week with some good help from this forum.

        2nd problem is the ODBC driver and TSQL driver files. Basically for Linux and Mac there are two choices, unixodbc and iodbc. I sat one night trying to get unixodbc to work with Qt but no dice. iodbc worked better, so now i have a /usr/lib/libiodbc.so (which libqsqlodbc.so wants). Then I downloaded the freetds package and built the file /usr/local/lib/libtdsodbc.so.0.0.0 (which is pulled in by .odbc.ini).

        3rd problem is that you cannot use a DSN-less connection, you have to write 2 small files in your ~ directory: .odbc.ini and freetds.conf

        Anyway, it took me a couple of nights, but now I have a working Qt program on my Ubuntu 13.10 that reads the Northwind database on my SQLServer2008 :-)

        I've been meaing to write a blog post about this "on my blog":http://tripleboot.org but laziness is a powerful force..

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved