Finally, we compiled the oracle QOCI driver of qt and connected the drivernotloaded solution.

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.