title: Unable to connect to Oracle 11g via OLE DB
body: <p>SOLVED: My VC++ application was in 32 bit and my Oracle DB was in 64 bit.  I initially though that the client would work with both versions of Oracle, however, it doesn't. I thus solved the problem by reinstalling Oracle 11g2 32bit.</p>
  
  <p>I'm trying to connect to a test Oracle 11g2 database via Visual Studio 2008 in C++.
  My database instance name is ORCL.TEST.DB, and the for testing purposes, I try to connect with user:SYSTEM  and password:admin.
  I'm also using the Oracle OLE DB connector.</p>
  
  <p>As you can see, I'm not trying anything fancy, I'm merely trying to successfully connect.</p>
  
  <pre><code>CDataSource ds;
  CSession session;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
  try{
      // fire up COM
      HRESULT hr = CoInitialize(0);
      if(FAILED(hr))
      {
          cout &lt;&lt; "Can't start COM!? " &lt;&lt; endl;
          return -1;
      }
  
      /// connect to the database
      //hr = ds.Open(L"OraOLEDB.Oracle", _T("ORCL"), _T("SYSTEM"), _T("admin"));
      hr = ds.OpenFromInitializationString(L"Provider=OraOLEDB.Oracle;Data Source=ORCL.TEST.DB;User Id=SYSTEM;Password=admin");
      if(FAILED(hr))
      {
          ////////////////THIS IS WHERE IT ENDS UP
          cout &lt;&lt; "Can't open db" &lt;&lt; endl &lt;&lt; hr &lt;&lt; endl;
          return -1;
      }
  }
  catch(...){
      cout &lt;&lt; "Unknown failure" &lt;&lt; endl;
      return -1;
  }
  return 0;
  }
  </code></pre>
  
  <p>The error code hr contains is 80004005, which is E_FAIL (unspecified failure).</p>
  
  <p>At first I thought it was a 32 vs 64 issue (64bit OS and 64bit Oracle, but 32bit C++ compiler in Visual Studio 2008). So I installed Oracle's Instant Client 32bit but it did not solve my problem.</p>
  
  <p>Any ideas?</p>