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. QSqlDatabasePrivate::database: unable to open database
Forum Updated to NodeBB v4.3 + New Features

QSqlDatabasePrivate::database: unable to open database

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 4.7k 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.
  • J Offline
    J Offline
    johnmerlino
    wrote on last edited by
    #1

    I'm getting the following error when trying to run a qt project:

    QSqlDatabasePrivate::database: unable to open database: "could not connect to server: Permission denied
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

    Now I was also getting this error when trying to log into postgresql but I resolved that issue using this post:

    http://stackoverflow.com/questions/6770649/repairing-postgresql-after-upgrading-to-osx-10-7-lion

    Once I added export PATH=/usr/local/bin:$PATH
    to the end of my .bash_profile on my mac lion, then I was able to log into postgresql:

    unknown045453009c92:.XKGateway johnmerlino$ psql -d db_development -U johnmerlino
    psql (9.1.2)
    Type "help" for help.

    xkdb_development=#

    However, even after that, still when I try to run the qt project, I get the error message and the database.json file it references contains the right database and username.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #2

      I think you've to call "QSqlDatabase":https://qt-project.org/doc/qt-5.0/qtsql/qsqldatabase.html instead of QSqlDatabasePrivate

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        make sure you have execute permissions on the following folders:

        • /var
        • /var/pgsql_socket

        A quick look up in the internet stated that you may also have to update your postgresql.conf and uncomment a line there to set the file permissions to 0777.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0

        • Login

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