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. QSqlDatabase specify database name after ip address
Forum Updated to NodeBB v4.3 + New Features

QSqlDatabase specify database name after ip address

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 427 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    brighton64
    wrote on 28 Oct 2021, 10:52 last edited by
    #1

    How can I connect to a database that is hosted on a specific ip address in such a manner that there are multiple databases on the same IP address.
    I tried using a forward slash like 10.214.1.101/testDatabase but its not working. Can someone please help me with the syntax to connect to the database.

    J 1 Reply Last reply 28 Oct 2021, 10:54
    0
    • B brighton64
      28 Oct 2021, 10:52

      How can I connect to a database that is hosted on a specific ip address in such a manner that there are multiple databases on the same IP address.
      I tried using a forward slash like 10.214.1.101/testDatabase but its not working. Can someone please help me with the syntax to connect to the database.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 28 Oct 2021, 10:54 last edited by
      #2

      @brighton64 What database is that? MySQL, PostgreSQL, something else?
      Please check https://doc.qt.io/qt-5/sql-connecting.html
      You can specify host (IP or host name) and database for each connection.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply 28 Oct 2021, 11:07
      1
      • J jsulm
        28 Oct 2021, 10:54

        @brighton64 What database is that? MySQL, PostgreSQL, something else?
        Please check https://doc.qt.io/qt-5/sql-connecting.html
        You can specify host (IP or host name) and database for each connection.

        B Offline
        B Offline
        brighton64
        wrote on 28 Oct 2021, 11:07 last edited by
        #3

        @jsulm It's my Mysql

        J 1 Reply Last reply 28 Oct 2021, 11:13
        0
        • B brighton64
          28 Oct 2021, 11:07

          @jsulm It's my Mysql

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 28 Oct 2021, 11:13 last edited by
          #4

          @brighton64 The link I posted shows an example with MySQL

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 28 Oct 2021, 11:32 last edited by
            #5

            Hi and welcome to devnet,

            You don't access a database like you do a website.

            You create as many connection to the database host as needed and for each connection you set the database name you want to connect to.

            As @jsulm already wrote, it's explained in the linked documentation.

            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

            1/5

            28 Oct 2021, 10:52

            • Login

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