Results 1 to 5 of 5

Thread: QSqldatabase open() failed to connect SQL server on other than default 1433 port

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QSqldatabase open() failed to connect SQL server on other than default 1433 port

    What is
    Qt Code:
    1. QSqlDatabase::lastError().text()
    To copy to clipboard, switch view to plain text mode 
    telling you?

  2. #2
    Join Date
    Dec 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QSqldatabase open() failed to connect SQL server on other than default 1433 port

    Thank you for your reply. The lastError().test() prints out as follow.

    "[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()). QODBC3: Unable to connect"

    Is any possible it still uses default 1433 port instead of specified port 5555?

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: QSqldatabase open() failed to connect SQL server on other than default 1433 port

    Check that with QSqlDatabase::port(). Because in your example code you do not set the port.

  4. #4
    Join Date
    Dec 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: QSqldatabase open() failed to connect SQL server on other than default 1433 port

    QSqlDatabase.port() return -1.
    Last edited by helen; 5th December 2011 at 20:22.

Similar Threads

  1. Connect to server with ip port and password (telnet)
    By halvors in forum Qt Programming
    Replies: 5
    Last Post: 6th April 2010, 18:23
  2. QSqlDatabase - How to connect to multiple database?
    By cutie.monkey in forum Qt Programming
    Replies: 4
    Last Post: 10th March 2010, 12:03
  3. Why QSqlDatabase::open() returns open?
    By gboelter in forum Newbie
    Replies: 7
    Last Post: 27th August 2009, 18:52
  4. QSqlDatabase default MySQL unix socket path
    By daggilli in forum Qt Programming
    Replies: 0
    Last Post: 21st September 2008, 19:55
  5. cannot connect to QSqldatabase
    By mave-rick in forum Qt Programming
    Replies: 3
    Last Post: 19th August 2008, 17:52

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
  •  
Qt is a trademark of The Qt Company.