title: Oracle 11g ado connection strings for ODBC (not OLEDB) using excel VBA 64 bit (DSN Less and tnsnames)
body: <p>Please help.  I have researched this for hours.  I get some parts to work but not others.</p>
  
  <p>What I am trying to do is write all the connection strings in excel VBA to connect to Oracle 11g database.  I don't want to set up the User DSN in ODBC Administrator and I don't want to have to maintain a tnsnames.ora file.</p>
  
  <p>I can get this to work for OLEDB connection strings but I believe this is no longer supported by Oracle so I want to use the Oracle ODBC Driver commands only.</p>
  
  <p>This is what I have got to work (which requires a tnsnames.ora file)</p>
  
  <p><code>DRIVER={Oracle in OraClient11g_home1};DBQ=MyTNSnamesALias;UID=xxxx;PWD=xxxx</code></p>
  
  <p>I have tried this also but I get a TNS Protocol error</p>
  
  <pre><code>DRIVER={Oracle in OraClient11g_home1};
  Server=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=hostname)(PORT=xxxx)))
  (CONNECT_DATA=(SERVICE_NAME=xxx)(SERVER=DEDICATED)));UID=xxxx;PWD=xxxx
  </code></pre>
  
  <p>Other useful information might be that i get my connections to work just fine when I use the DSN name as per the ODBC Administrator.</p>
  
  <p>Any suggestions would be greatly appreciated</p>
  
  <p>Thanks</p>