title: Oracle access from C# program
body: <p>I would appreciate any advice to resolve this problem.<br>
  I'm not a pro developer but a "hobbyist" who has "inherited" a reporting job (thanks to my interest in programming - classic example of 'never volunteer'!).    </p>
  
  <p>I'm trying to access an Oracle 10g database from C#.<br>
  To keep things as simple as possible I've got a bare WPF form with a single button.
  Inside the click event of the button, I've got the following code (which, incidentally worked fine in an earlier program set up on a different PC) -</p>
  
  <pre><code>using System.Data;
  using System.Data.OracleClient;
  
  ...
  
  string oraStr1 = "Data Source=(DESCRIPTION=(ADDRESS_LIST =(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort)))(CONNECT_DATA=(SERVICE_NAME=myDB)));Password=myPassword;User ID=myUser;";
  
  DataTable oraTable = new DataTable();
  string queryString = "Select surname,forenames from person table where surname = 'Smith'";
  
  using ( OracleConnection oraConnect = new OracleConnection( oraStr1 ) )
  {
      try
      {
          OracleCommand OraCmd = new OracleCommand( queryString, oraConnect );  
          oraConnect.Open();
  
          OracleDataAdapter OraAdapter = new OracleDataAdapter();
          OraAdapter.SelectCommand = OraCmd;
  
          OraAdapter.Fill( oraTable );
      }
      finally
      {
          oraConnect.Close();
      }
  </code></pre>
  
  <p><strong><em>Now...</em></strong> the (C# Express Edition) application is running in a VM on a remote server.
  My <em>share</em> on this VM has also had Oracle Database 10g Client Release 2 (10.2.0.1.0) installed.    </p>
  
  <p>In addition I've had the Oracle Data Access Components installed by IT.    </p>
  
  <p>When running ODBCAD32 in the VM no Oracle drivers are listed in the drivers tab.    </p>
  
  <p>I believe the driver installed has failed and this is preventing my program from initiating any connection. However, I've no proof and was wondering if the learned people here could advise on obtaining any...?    </p>
  
  <p>The first few lines of the IDE error message read -    </p>
  
  <pre><code>System.Exception was unhandled
  Message="OCIEnvCreate failed with return code -1 but error message text was not available."
  Source="System.Data.OracleClient"
  StackTrace:
       at System.Data.OracleClient.OciHandle..ctor(OciHandle parentHandle, HTYPE handleType, MODE ocimode, HANDLEFLAG handleflags)
       at System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName)
       at System.Data.OracleClient.OracleInternalConnection..ctor(OracleConnectionString connectionOptions)
       at System.Data.OracleClient.OracleConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OracleClient.OracleConnection.Open()    
  </code></pre>
  
  <p>Sorry to be so long-winded but as you can see, this set-up is fairly complex... :)    </p>
  
  <p>I'm not qualified to tell IT their job but would appreciate any <strong><em>advice</em></strong> that I could pass on?</p>