By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,372 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,372 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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.

"ben" <be********@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #2

P: n/a
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" <be********@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #3

P: n/a
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.

"ben" <be********@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #4

P: n/a
Miha,
Thanks for the timely advice..
Adding the identity impersonate tag to the web.config file did the trick...

Richard
"Miha Markic" <miha at rthand com> wrote in message
news:e3**************@TK2MSFTNGP09.phx.gbl...
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" <be********@yahoo.com> wrote in message
news:ed**************@TK2MSFTNGP09.phx.gbl...
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


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.