System.Data.OracleClient Problem: Could not create an environment: OCIEnvCreate returned -1

B

ben

Below is the error message I am receiving on a production server with the
Oracle 9.2 client installed. However, on a Oracle 9.0 client installation on
the development server the problem does not occur.

System.Exception: Could not create an environment: OCIEnvCreate returned -1.

This occurs when trying to connect.

using System.Data.OracleClient
this.connection = new OracleConnection("Data Source=" +
ConfigurationSettings.AppSettings["db_orac"] + ";User ID=" +
ConfigurationSettings.AppSettings["db_user"] + ";Password=" +
ConfigurationSettings.AppSettings["db_pass"] + ";");
this.connection.Open();

this.command = new OracleCommand();
this.command.Connection = this.connection;

ds = new DataSet();

command.Parameters.Clear();
command.CommandText = "MyTableSpace.MyPackage.get_list";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new OracleParameter("io_cursor",
OracleType.Cursor)).Direction = ParameterDirection.Output;

this.da = new OracleDataAdapter(this.command);
this.da.Fill(ds,"List");

this.connection.Close();

I am desperately trying to find a solution. Any help would be much
appreciated!!

Regards,

Ben
 
E

Elliot M. Rodriguez

Ben:

This might be a permissions problem as the asp.net worker process needs
access to the Oracle directory. Try granting it read access and see if that
helps.
 
M

Miha Markic

Hi ben,

I think Elliot is right - just give aspnet process enough privileges to
oracle's bin directory (and directories below).
Or run aspnet app under another account:
Just put a line into
web.config file somewhere under
<system.web> node:

<identity impersonate="true" userName="USER" password="PASSWORD"/>
 
R

Richard A. Michaels

Ben,

I'm having the same problem. However, it only happens for ASP.Net.

I often will do much of my testing of routines and data access from a fat
client before moving the code to the ASP.Net side. I spent much of my time
yesterday developing the code in my test app, when I moved it to ASP.Net the
problem occurred.
 
R

Richard A. Michaels

Miha,
Thanks for the timely advice..
Adding the identity impersonate tag to the web.config file did the trick...

Richard
Miha Markic said:
Hi ben,

I think Elliot is right - just give aspnet process enough privileges to
oracle's bin directory (and directories below).
Or run aspnet app under another account:
Just put a line into
web.config file somewhere under
<system.web> node:

<identity impersonate="true" userName="USER" password="PASSWORD"/>


--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

ben said:
Below is the error message I am receiving on a production server with the
Oracle 9.2 client installed. However, on a Oracle 9.0 client
installation
on
the development server the problem does not occur.

System.Exception: Could not create an environment: OCIEnvCreate returned -1.

This occurs when trying to connect.

using System.Data.OracleClient
this.connection = new OracleConnection("Data Source=" +
ConfigurationSettings.AppSettings["db_orac"] + ";User ID=" +
ConfigurationSettings.AppSettings["db_user"] + ";Password=" +
ConfigurationSettings.AppSettings["db_pass"] + ";");
this.connection.Open();

this.command = new OracleCommand();
this.command.Connection = this.connection;

ds = new DataSet();

command.Parameters.Clear();
command.CommandText = "MyTableSpace.MyPackage.get_list";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add(new OracleParameter("io_cursor",
OracleType.Cursor)).Direction = ParameterDirection.Output;

this.da = new OracleDataAdapter(this.command);
this.da.Fill(ds,"List");

this.connection.Close();

I am desperately trying to find a solution. Any help would be much
appreciated!!

Regards,

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top