Results 1 to 2 of 2

Thread: Problems connecting to SQL Server 2005 from Windows 7

  1. #1
    Join Date
    Dec 2010
    Posts
    35
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Problems connecting to SQL Server 2005 from Windows 7

    I have a Qt-based application that communicates with databases. I compiled Qt (4.7.4) statically and built in support for MySQL and ODBC. I connect to MySQL and SQL Server databases in my development environment.

    I've been working well for many months and now I'm deploying my application on different systems.

    I deploy my statically built executable along with the 'libmysql.dll' library. I can successfully connect to MySQL with this application. When trying to connect to SQL Server (using the ODBC driver), I specify the following as the databaseName (QSqlDatabase.setDatabaseName():

    DRIVER={SQL Server};SERVER=%1;DATABASE=%2;UID=%3;PWD=%4

    - where %1 is the hostname, %2 is the database name.

    SQL Server is running on a Windows Server 2008 SP2 system. SQLServer version is 2005 (9.0.1399).

    If I run my program on XP or Vista systems I can successfully connect to that DB. However, if I run my program on a windows 7 32-bit or 64 system, I get the following error from the QSqlDatabase.open() call:

    "Specified driver could not be loaded due to system error 126: The specified module could not be found. (SQL Server, %WINDIR%\system32\SQLSRV32.dll). QODBC3: Unable to connect"

    I checked and, yes, the SQLSRV32.dll exists in the system32 directory.

    I can connect to this database from my Windows 7 64-bit development environment system.

    I seem to be missing some bit of configuration or run-time environment foo on that win 7 32-bit system. I'm using VS 2008 for development and installed the VS2008 redistributable on that win7-32 system. Still doesn't work....

    Ideas?

  2. #2
    Join Date
    Dec 2010
    Posts
    35
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problems connecting to SQL Server 2005 from Windows 7

    The full story is that I'm launching this Qt-based application from a Java program. The Java program needs to specify the entire working environment for the Qt application (as a separate process).

    Windows 7 now uses/references the environment variable 'WINDIR' in the registry whereas before it pretty much hard-coded 'c:\windows' everywhere.

    I just had to set the 'WINDIR' environment variable in the process that launched the Qt application.

    Issue resolve.

Similar Threads

  1. Accessing Microsoft SQL server 2005
    By yuvarajragupathi in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2010, 13:20
  2. QSslSocket - problem with connecting to the server
    By kremuwa in forum Qt Programming
    Replies: 9
    Last Post: 26th August 2010, 15:40
  3. Trying to Connect To SQL Server 2005
    By rossd in forum Installation and Deployment
    Replies: 0
    Last Post: 6th March 2009, 20:56
  4. Problems connecting PushButtons
    By Randulf in forum Newbie
    Replies: 3
    Last Post: 23rd August 2006, 15:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.