Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting A Basic OCI C++ Application To Compile

1064063Jan 11 2014 — edited Jan 17 2014

Can someone please tell me what I am missing?

I downloaded Oracle instantclient-basic-nt-12.1.0.1.0.zip and instantclient-sdk-nt-12.1.0.1.0.zip and extracted both to c:\oracle\

I then went into visual studio 2013 and created a Win32 Console application with all default parms.

I then went into project -> properties -> C/C++ -> General -> Additional Include Directories and added my include path C:\oracle\sdk\include

I then went into project -> properties -> Linker -> General -> Additional Library Directories and added C:\oracle\sdk\lib\msvc\vc11

I then went into project -> properties -> Linker -> Input -> Additional Dependancies and added oraocci12.lib

The program compiles but when I debug i get a RUNTIME error that says "The program can't start because oraocci12.dll is missing from your computer.  Try reinstalling the program to fix this problem.  But I know the file exists in C:\oracle\sdk\lib\msvc\vc11\oraocci12.lib

What am I doing wrong?  Any help is greatly appreciated!

This is the code if it makes a difference

#include "stdafx.h"

#include <iostream>

#include <occi.h>

using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{

    oracle::occi::Environment* environment;

    oracle::occi::Connection *con;

    oracle::occi::Statement* stmt;

    oracle::occi::ResultSet* res;

    try{

        environment = oracle::occi::Environment::createEnvironment(oracle::occi::Environment::DEFAULT);

        con = environment->createConnection("gldbuser", "gldbuser", "MYDATABSE");

        stmt = con->createStatement("select * from example");

        res = stmt->executeQuery();

        while (res->next())

            std::cout << res->getInt(1) << "  " << res->getString(2) << std::endl;

        stmt->closeResultSet(res);

        con->terminateStatement(stmt);

        environment->terminateConnection(con);

    }

    catch (oracle::occi::SQLException &e){

        std::cout << e.what();

    }

    return 0;

}

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2014
Added on Jan 11 2014
2 comments
4,308 views