Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, December 2007
QOCI Error (Help Please!)


Message 1 in thread

I have fussed with this problem for three days, so any help would be 
really really appreciated!

I am running QT 4.3.3 statically compiled on window and linux. My 
application simply connects to an Oracle database and makes a few 
inserts. On linux, I have no problems and on the windows machine where I 
built the application I have no problems. However, when I try to run it 
from a clean Windows machine, I get the following error:

QOCIDriver: unable to create environment:
QOCIDriver: unable to alloc error handle:

I have included all of the dll's that I used to build the application 
and QT with, including oci.dll. In fact, I have dumped all the dll's 
from the instant client library.

There is one important difference between the two environments: the 
machine where I built the application (and it runs fine on) also 
contains an Oracle Express installation. I noticed that the Oracel 
Express bin path is in the enviromental path. However, requiring an 
Oracle installation on the clients is not an option. So, I need to know 
what I need to include to make this work on clean machines.

For a little reference, I had a look at that QOCI source and noticed 
that both of these  errors come from the constructor:

QOCIDriver::QOCIDriver(QObject* parent)
    : QSqlDriver(parent)
{
    d = new QOCIPrivate();

    const ub4 mode = OCI_UTF16 | OCI_OBJECT;
    int r = OCIEnvCreate(&d->env,
                         mode,
                         NULL,
                         NULL,
                         NULL,
                         NULL,
                         0,
                         NULL);
    if (r != 0)
        qOraWarning("QOCIDriver: unable to create environment:", d);
    r = OCIHandleAlloc((dvoid *) d->env,
                        (dvoid **) &d->err,
                        OCI_HTYPE_ERROR,
                        (size_t) 0,
                        (dvoid **) 0);
    if (r != 0) {
        qOraWarning("QOCIDriver: unable to alloc error handle:", d);
        setLastError(qMakeError(tr("Unable to initialize", "QOCIDriver"),
                     QSqlError::ConnectionError, d));
    }
}

Both OCIEnvCreate and OCIHandleAlloc are OCI calls. This says to be that 
there MUST be something in the Oracle Express bin that lets it work on 
the build machine. Any ideas? If no one knows, I suppose that my next 
step is to use the process of elimination.

Thanks
Shane C. Mason

--
 [ signature omitted ] 

Message 2 in thread

Shane C. Mason wrote:

> I have included all of the dll's that I used to build the application 
> and QT with, including oci.dll. In fact, I have dumped all the dll's 
> from the instant client library.
> 
> There is one important difference between the two environments: the 
> machine where I built the application (and it runs fine on) also 
> contains an Oracle Express installation. I noticed that the Oracel 
> Express bin path is in the enviromental path. However, requiring an 
> Oracle installation on the clients is not an option. So, I need to know 
> what I need to include to make this work on clean machines.

You don't need a full Oracle installation - the instant client should be 
enough.

Maybe the easiest thing is to run the installer instead of copying the 
files manually. That being said, on my system I have: oci.dll, 
ociw32.dll, orannzsbb10.dll and oraociei10.dll in addition to the Qt 
dlls. I also have an installation of Oracle Express, but I removed it 
from the path and could still connect.

... and don't forget tnsnames.ora!


--
 [ signature omitted ]