views:

105

answers:

1

I'm using an Oracle database(10g) which contains a stored procedure called Foo.

Foo takes 2 datetime as IN parameters and 1 cursor as OUT parameter. I've been trying to make the connection and the query to the database with the OleDbCommand, but since Foo needs a cursor I have no choice but to use a OracleCommand(right?).

When I try to connection to the database I get the following error : "OCIenvCreate has failed return code -1". I've gived the correct permissions to ASPNET user for the oci.dll file so that it can read and execute it. Unfortunately, I still get the same error and I'm lost.

Here is what cause the error

        OracleConnectionStringBuilder conBuilder = new OracleConnectionStringBuilder();
        conBuilder.DataSource = dataSrc;
        conBuilder.UserID = user;
        conBuilder.Password = password;

        OracleConnection con = new OracleConnection(conBuilder.ConnectionString);

        OracleCommand cmd = new OracleCommand("foo", con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.Add("this_is_a_cursor", OracleType.Cursor).Direction = ParameterDirection.Output;

        con.Open(); // Cause the error at runtime
        OracleDataReader reader = cmd.ExecuteReader();
        GridView1.DataSource = reader;
        GridView1.DataBind();
        con.Close();

I've noticed that some other people are having the same problem.

I'm running the application from a Windows Server 2003 Entreprise Edition(I hope this can help).

Thank you.

A: 

I'm not quite sure what the exact problem was, but I managed to connect to my database with another provider in the connection string.

Frank