{"id":1000,"date":"2016-10-09T18:51:14","date_gmt":"2016-10-09T16:51:14","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=1000"},"modified":"2016-10-09T22:14:36","modified_gmt":"2016-10-09T20:14:36","slug":"what-to-do-about-qpsql-driver-not-loaded","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=1000","title":{"rendered":"What to do about &#8220;QPSQL driver not loaded&#8221;"},"content":{"rendered":"<p>If you created a PostgreSQL database object in your code with QtSql&#8217;s <code>QSqlDatabase::addDatabase(\"PSQL\");<\/code> your will sometimes get an Application Output like this:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Application output with Postgre Client Libs missing\">QSqlDatabase: QPSQL driver not loaded.\r\nQSqlDatabase: available drivers: QSQLITE<\/pre>\n<p><!--more--><\/p>\n<p>What&#8217;s going on here is that the application tells your operating system that it is lacking the needed database client libraries. The <a href=\"https:\/\/briolidz.wordpress.com\/2011\/11\/20\/postgresql-driver-for-windows-and-linux\/\" target=\"_blank\" class=\"broken_link\">solution<\/a> is&#8230;<\/p>\n<p>to make sure that your <code>postgresql-client<\/code> libraries are installed on your system:<\/p>\n<pre class=\"lang:default decode:true\" title=\"Installing PostgreSQL client libraries\">sudo apt-get install postgresql-client<\/pre>\n<p>&#8230; and to make sure that your Qt PostgreSQL plugin is installed. This is a bit more tricky, there is a <code>libqt4-sql-psql<\/code> and a <code>libqt5-sql-psql<\/code> plugin. As per the default Ubuntu 16.04 installation of Qt Creator, you should find <code>libqsqlpsql.so<\/code> under <code>\/usr\/lib\/x86_64-linux-gnu\/qt4\/plugins\/sqldrivers<\/code>. In case it is not there, install it by:<\/p>\n<pre class=\"lang:default decode:true \" title=\"Installing Qt-Postgresql plugin\">sudo apt-get install libqt4-sql-psql<\/pre>\n<p>Some folks recommend to explicitly register the plugin library by running <code>ldd<\/code> on the file. From my experience though, this is not necessary if the plugin was directly installed by <code>apt-get<\/code> as shown above.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you created a PostgreSQL database object in your code with QtSql&#8217;s QSqlDatabase::addDatabase(&#8220;PSQL&#8221;); your will sometimes get an Application Output like this: QSqlDatabase: QPSQL driver not loaded. QSqlDatabase: available drivers:<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=1000\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">What to do about &#8220;QPSQL driver not loaded&#8221;<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[64],"tags":[213,216,215,212,214],"class_list":["post-1000","post","type-post","status-publish","format-standard","hentry","category-linux","tag-database-driver","tag-postgresql","tag-qpsql","tag-qt","tag-qt-creator"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1000"}],"version-history":[{"count":4,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1000\/revisions"}],"predecessor-version":[{"id":1006,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/1000\/revisions\/1006"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}