title: OracleDataAdapter.Fill "Connection must be open" error
body: <p>I have some code that uses ODP.Net </p>
  
  <pre><code>using (OracleConnection connection = new OracleConnection(connectionString))
  {
    connection.Open();
    boxCommand = new OracleCommand(sql, connection);
  
    OracleDataAdapter boxAdapter = new OracleDataAdapter(boxCommand);
    DataTable boxTable = new DataTable();        
  
    boxAdapter.Fill(boxTable);
  }
  </code></pre>
  
  <p>I then get an error below on a production server. The test server is fine.</p>
  
  <p><img src="https://i.stack.imgur.com/IOatk.jpg" alt="Error Image"></p>
  
  <p>I don't understand as its complaining about a connection not being open but if there was a problem it should occur at the point my <code>Open</code> is called not on the <code>Fill</code>. Also I thought <code>Fill</code> was supposed to open the connection anyway.</p>
  
  <p>Can anyone suggest what might be going on?</p>
  
  <p><strong>UPDATE: From the comments I tried adding this but same problem:</strong></p>
  
  <pre><code>using (OracleConnection connection = new OracleConnection(connectionString))
  {
    connection.Open();
    while(connection.State != ConnectionState.Open)
    {
       connection.Close();
       connection.Open();
    }
    boxCommand = new OracleCommand(sql, connection);
  
    OracleDataAdapter boxAdapter = new OracleDataAdapter(boxCommand);
    DataTable boxTable = new DataTable();        
  
    boxAdapter.Fill(boxTable);
  }
  </code></pre>
  
  <p><strong>UPDATE 2 : I have added logging and the Validate Connection = true to the connection string and I know the connection state is open, the box command was done, the adapter created and the table created, it definitely errors on the Fill</strong></p>