title: Connect to Oracle 11.2 with Visual Studio 2012 C++
body: <p>I am trying to make a connection to Oracle 11.2 using OCCI and Visual Studio 2012 c++.</p>
  
  <p>I have followed the following steps.</p>
  
  <ol>
  <li><p>Get instantclient-basic-windows.x64-11.2.0.4.0,    instantclient-sdk-windows.x64-11.2.0.4.0 and    instantclient-sqlplus-nt-11.2.0.4.0 and extract to C:  (Then it    should be C:\instantclient_11_2)</p></li>
  <li><p>Extract OCCI for visual studio 2010 (This is the latest version on    <a href="http://www.oracle.com/technetwork/database/occidownloads-083553.html" rel="nofollow">http://www.oracle.com/technetwork/database/occidownloads-083553.html</a>)</p></li>
  <li><p>Configurations<br>
  In C:\instantclient_11_2\vc10 add the oraocci11.dll and oraocci11d.dll from OCCI.
  In C:\instantclient_11_2\sdk\lib\msvc\vc10 add the oraocci11d.lib and oraocci11.lib</p></li>
  <li><p>Set the paths in system path variables as       C:\instantclient_11_2\sdk\lib\msvc\vc10; C:\instantclient_11_2;</p></li>
  <li><p>set the library paths in    project->properties->linker->Input->Additional Dependencies     C:\instantclient_11_2\sdk\lib\msvc\vc10\oraocci11.lib     C:\instantclient_11_2\sdk\lib\msvc\vc10\oraocci11d.lib</p></li>
  <li><p>Edit VC++ directories  Include C:\instantclient_11_2\sdk\include;$(IncludePath)  Library Directories    : C:\instantclient_11_2\sdk\lib\msvc\vc10;$(LibraryPath)</p></li>
  <li><p>64bit configuration environment</p></li>
  <li><p>Tools->Options-Debugging->Symbol->Microsoft Symbol Servers if necessary</p></li>
  </ol>
  
  <p>The program,</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;occi.h&gt;
  
  namespace oc = oracle::occi;
  
  int main()
  {
      try
      {
          // setup
          oc::Environment* env = oc::Environment::createEnvironment(oracle::occi::Environment::DEFAULT); // 1
  
          try{
              oc::Connection* conn = env-&gt;createConnection("ASD", "ASD123", "dbName"); // 2
          }
          catch(const oc::SQLException&amp; e){
              std::cout  &lt;&lt; e.what() &lt;&lt; std::endl; 
              exit(EXIT_FAILURE); 
          }
          oc::Environment::terminateEnvironment(env); 
      }
      catch(const oc::SQLException&amp; e) // 7
      {
          std::cout &lt;&lt; "Exception: " &lt;&lt; e.what() &lt;&lt; std::endl;
      }
  
      system("pause");
  }
  </code></pre>
  
  <p>But I keep getting the following issues,</p>
  
  <p>'testSample4.exe' (Win32): Loaded 'C:\instantclient_11_2\sdk\lib\msvc\vc10\oraocci11.dll'. Cannot find or open the PDB file.</p>
  
  <p>and </p>
  
  <p>First-chance exception at 0x000007FEFD41ADCD in testSample4.exe: Microsoft C++ exception: oracle::occi::SQLException at memory location 0x000000000031E7E8.</p>
  
  <p>Then get the error : the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255</p>
  
  <p>Can someone help me with this please...</p>