Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> OCCI create environment
I am new to OCCI and am using VS.NET to access Oracle database. I am having
problems with the createConnection call. When I execute the program I get
the following error "An unhandled exception of type
'System.NullReferenceException' occurred in database.exe Additional
Information: Object reference not set to an instance of an object" And it
points to this line conn = env->createConnection (user, passwd, db); This
is one of oracle's examples and I don't understand why the string db is "" I
would think it would have information on the database you are trying to
access. Any suggestions? Thanks.
#include <iostream>
#include <occi.h>
using namespace oracle::occi;
using namespace std;
class occidml
{
private:
Environment *env;
Connection *conn;
Statement *stmt;
public:
occidml (string user, string passwd, string db)
{
env = Environment::createEnvironment (Environment::DEFAULT);
conn = env->createConnection (user, passwd, db);
}
~occidml ()
{
env->terminateConnection (conn);
Environment::terminateEnvironment (env);
}
int main (void)
{
string user = "own";
string passwd = "own";
string db = "";
cout << "occidml - Exhibiting simple insert, delete & update operations"
<< endl;
occidml *demo = new occidml (user, passwd, db);
} Received on Thu Nov 13 2003 - 11:47:28 CST