Like you and me, I think the connection is successful after the oracle-driven QOCI of qt is finally compiled !!! QOCI has been compiled in this article. I have encountered the following error: (I directly use the original code) QSqlDatabase: QOCIdrivernotloadedQSqlDatabase: availabledrivers: qsqliteqmysqlqmysql3qodbcqodbc3qpsqlqpsql
Like you and me, I think the connection is successful after the oracle-driven QOCI of qt is finally compiled !!! QOCI has been compiled in this article. I have encountered the following error: (I directly used the original code) QSqlDatabase: QOCI driver not loadedQSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7e
Like you and me, I think the connection is successful after the oracle-driven QOCI of qt is finally compiled !!!
QOCI has been compiled in this article. I have encountered the following error: (I directly use the original code)
QSqlDatabase: QOCI driver not loadedQSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7error_Oracle: "Driver not loaded Driver not loaded"
To solve this problem, we have to say in principle:
Thin is a pure java c/s communication for TCP/IP. In oci mode, the client calls c library through native java method to access the server, this c library is the oci (oracle called interface). Therefore, this oci always needs to be installed with the oracle Client (from oracle10.1.0, the OCI Instant client is provided separately, and the complete Client installation is not required)
Most of the time, we consider whether the DLL under $ QTDIR/plugins/sqldrivers we compiled is correctly loaded, while ignoring whether the database on the Oracle side is loaded.
The solution is
Method 1: add your Oracle oci. dll library in the System Path Environment Variable C: \ oracle \ product \ 10.2.0 \ client_1 \ BIN. If you correctly install the Oracle client, this problem should not exist.
Method 2: Use QT's own loadlibrary to load the oci. dll library location.
The method I used is 1 + 2 and has been tested.
QLibrary * hello_lib = NULL; // write down the library path. If it is placed in the directory of the current project, the path is. /Oracle. so hello_lib = new QLibrary ("C: \ oracle \ product \ 10.2.0 \ client_1 \ BIN \ oci. dll "); // load the dynamic library hello_lib-> load (); if (! Hello_lib-> isLoaded () {printf ("load Oracle failed! \ N "); return ;}
Note that the Oracle client must be installed regardless of method 1 or method 2. In addition, I do not know whether the libraries compiled by QT are common or not.
I also encountered a problem in WIN7:
QOCIDriver: unable to create environmenterror_Oracle: " Unable to logon"
You should have encountered this problem using PL/SQL.
Solution:
1. Right-click to run with an Administrator Account
2. The Program path cannot contain (), and cannot be logged on to a path similar to "C: \ Program Files (x86. I only know that 10 is not good. I don't know if 12 has changed.