locked
System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available RRS feed

  • Question

  • My situation:

    I'm looking to open a connection to an oracle database using the OracleConnection object. 

    I have oracle 10g running on a virtual machine.

    I have Ora_Db10g_home1 installed on my local machine.

    I'm able to pull up sql plus just fine on my local machine and access the orable database located on the virtual machine.

    I am able to go into the Net Configuration Assistant to test my tnsnames.ora file.  This returns a success connection.

    I then go create my ODBC.  I create a Ora_Db10g_home1 driver data source.  This connection test is successful. When I go to write my code I get the following error when I try to open the connection string:  System.Exception: OCIEnvCreate failed with return code -1 but error message text was not available.

     The following is my code, my connection string is 100% correct...... does any one know why I'm getting this error?

    namespace LookupInspectionDataHandler

    {

     

    public class LookupInspectionData : IIntegrationHandler

    {

    #region Variables

    OracleConnection aOracleConnection = new OracleConnection();

    Config aConfig;

     

    #endregion

    #region IIntegrationHandler Members

    public void Initialize(string messageType, string configuration)

    {

    //Deserialize configuration

    using (StringReader reader = new StringReader(configuration))

    {

    XmlSerializer serializer = new XmlSerializer(typeof(Config));

    this.aConfig = serializer.Deserialize(reader) as Config;

    }

    string aConnectionString = "Data Source=vfa;Persist Security Info = True;User ID=UserId;Password=Password;Unicode=True";

    aOracleConnection.ConnectionString = aConnectionString;

    //open connection

    try

    {

    aOracleConnection.Open();

    }

    catch (Exception e)

    {

    throw new Exception(e.ToString());

    }

    }

    Thursday, November 1, 2007 8:45 PM

Answers