Results 1 to 6 of 6

Thread: can qt access remote database?

  1. #1
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default can qt access remote database?

    i try the following code on my own computer, it can access to the database (the database is on my own computer).
    However, when i run this code on another computer, it cannot access to the database


    xxx.xxx.xxx.xx is the ip address of my own computer (which launch the MSSQL)

    i try whole days, but still no idea :/
    can anyone give me some suggestions?
    Thank you very much!

    QString serverName = "xxx.xxx.xxx.xx\\SQLEXPRESS";
    QString dbName = "myDB";
    QString dbID = "sa";
    QString dbPW = "abcd";

    QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    QString dsn = QString("DRIVER={SQL Server Native Client 10.0};SERVER=%1;DATABASE=%2;UID=%3;PWD=%4;").arg(s erverName).arg(dbName).arg(dbID).arg(dbPW);

    db.setDatabaseName(dsn);

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: can qt access remote database?

    Qt uses the actual database software as backends.
    As long as the database you use supports it, Qt will support it too.

    Of course, you need to make sure that the computer containing the database is accessible. Are the ports open? Is a server running? etc...

  3. #3
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can qt access remote database?

    i sure that the database is accessible since it can connect and retreive the data from the database on my own computer.
    but it doesn't work when the remote computer wants to access my database (MSSQL)

  4. #4
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: can qt access remote database?

    And that's because You didn't allow access from the network (You can access from localhost but not from i.e. 192,x ).
    Read this it should help.
    In the near future - corporate networks reach out to the stars. Electrons and light flow throughout the universe.
    The advance of computerization however, has not yet wiped out nations and ethnic groups.

  5. #5
    Join Date
    Oct 2010
    Posts
    11
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: can qt access remote database?

    I solved the problem by myself now.

    Since the client side do not install SQL Server Native Client 10.0, so they can't connect to the server's database

    thanks all.

  6. #6
    Join Date
    Nov 2012
    Posts
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi
    Platforms
    Windows Symbian S60

    Default Re: can qt access remote database?

    HI Please mail me solution please As soon as possible.

    I want to connect my mobile to my system database .

    how to do so... call me +91-9686911900 or amitkumarmannur@gmail.com
    I want to wirte a program which i can deploy in mobile

Similar Threads

  1. Remote Device Access
    By Guilo in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 14th June 2010, 15:33
  2. Replies: 2
    Last Post: 15th April 2010, 14:59
  3. Problem connecting to remote database
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2009, 10:59
  4. Database access from Qt
    By nimmyj in forum Newbie
    Replies: 1
    Last Post: 23rd November 2006, 09:52
  5. Database access from Qt
    By nimmyj in forum Qt Programming
    Replies: 1
    Last Post: 23rd November 2006, 06:51

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.