Solved QSqlDatabase:QPSQL Driver not loaded Driver not loaded
-
@SGaist These are my postgres packages installed
- postgresql/xenial-updates,xenial-updates,xenial-security,xenial- security,now 9.5+173ubuntu0.1 all [installed]
- postgresql-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]
- postgresql-client-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed]
- postgresql-client-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed]
- postgresql-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 173ubuntu0.1 all [installed,automatic]
- postgresql-contrib-9.5/xenial-updates,xenial-security,now 9.5.12-0ubuntu0.16.04 amd64 [installed,automatic]
I also have installed libpq5 and libpq-dev on my computer.
-
@ram070787 What about libpqxx-dev ?
-
There's something mighty fishy here.
Did you install of Qt's development packages from your distribution ?
What do you get if you runldd
on the PostgreSQL plugin ? -
@SGaist If I am right by Qt development package you mean the qtdeclarative5-dev packages. I had those installed.
I did not understand where this PostgreSQL plugin is? A "ldd psql" had all the dependencies.
-
@jsulm Yeah those were installed.
-
I already spent a week trying to find the error and unsuccessful. so I have reinstalled my complete system. I will try to install all essential libraries and softwares and will come back here again. Thanks everyone for your help.
-
Hi guys. I have found the reason for this. But not sure what to do about this. Maybe you guys are experienced in this.
My application runs by reading an .ini file in the folder "etc/myfile.ini" and automatically generates the same myfile.ini in my home folder with some details about my login credentials to the application that is built by Qt. The first run in my Qt opens my application and an .ini file is generated in my home folder. When I stop my application and restart it is gives "unknown driver error". So this .ini file is not generated again afresh. I have to delete the old .ini file in my home folder before running my application again.
Also my application gets a connection with the Sql database and the details about the database are written in the .ini file generated in my home folder. These details are written in another computer and not in mine.
-
Hi guys.. I found the reason for my failure in driver. It was a error within the project itself. The error seems a bit wierd initially but reinstalling showed me more about the error. The .ini file generation was having some problem and now I fixed it and it is all fine.. Thanks a lot for everyone..
-
Glad you found out and thanks for sharing !
Would you mind sharing what is in this ini file that wreaks such havoc in your application ?
-
@SGaist I am really sorry I cant share this .ini file with you.
But this .ini file has the database details (which driver should be used), server details that the application should connect to. I manually edited this file and made sure all the required paths are set and i was able to start my application in Qt and establish a connection to my database.
-
Thanks for the information !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)
-
Very curious the idea of a specific file ".ini" . I did'nt found a such file ".ini" in my project ....Bizarre....
-
Hi and welcome to devnet,
@monfortpie said in QSqlDatabase:QPSQL Driver not loaded Driver not loaded:
Very curious the idea of a specific file ".ini" . I did'nt found a such file ".ini" in my project ....Bizarre....
Because it's specific to how @ram070787 implemented its application, not something that is general.