Results 1 to 5 of 5

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

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

    SQL server uses other than default 1433 port (e.g. 5555), system DSN created using the port 5555 and tested completed successfully.

    However, QSqlDatabase failed to open database.

    The code snippets:

    Qt Code:
    1. QSqlDatabase *db = QSqlDatabase :: addDatabase("QODBC");
    2. db->setDatabaseName("test");
    3. db->setUserName(userName);
    4. db->setPassword(passWord);
    5.  
    6. if ( db->open() ){
    7. ///Database open successfully.....
    8. }
    9. else
    10. {
    11. ///Database open failed
    12. }
    To copy to clipboard, switch view to plain text mode 

    It's greatly appreciated for any help to solve this problem.
    Last edited by helen; 5th December 2011 at 20:24.

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.