Search code examples
qtoracle11gqt4oracle-call-interface

Qt how use OCI driver without installing Oracle client


Is there a way to use the Qt OCI driver without installing Oracle client ? Maybe using static libs from Oracle while we build the driver? Or using some Oracle client dlls and with some env variable setup?

The thing is I can't ask my clients to install oracle client before using my application. They expect my application to up and running without any hassle.

If this cannot be achieved then what do we have as alternatives?

  • OS=Windows 7
  • Qt=4.8.6

Solution

  • If anyone interested this is how I have done it.

    1. Read http://docs.oracle.com/cd/B12037_01/appdev.101/b10779/oci01int.htm#423364 Forget about patching part.
    2. Download oracle instant client http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html. This is a zip file, no installation required, just extract it application contains. (alternatively we can extract somewhere else and include the location into Path env variable)
    3. As now we don't have client installed, we don't have a tnsnames.ora file also. So set the ip, port and service name directly. (Alternatively we can use TNS_ADMIN env variable if we want tnsnames.ora file badly) Ex:
       o_Database.setHostName("10.10.10.225");
       o_Database.setPort(1521);
       o_Database.setDatabaseName("ora11g");
    
    1. That is it. It should work perfectly.

    Meantime, it is legal to distribute the Oracle instant client DLLs.