title: Connecting to Oracle via VBA
body: <p>All,</p>
  
  <p>I am trying to connect to an oracle database via the Cloud through VBA.  Below is my code.  When I debug print my VBA after the variable "strConOracle" is set, the variable prints as below</p>
  
  <p><strong><em>strConOracle</em></strong>
  Provider=OraOLEDB.Oracle;Dat<code>enter code here</code>a Source=coloplast-stg-rdb.cloud.modeln.com:4004:CPHSTG; User ID=jpathil;Password=Jean1121;</p>
  
  <p>This seems ok since my database credentials that I connect with via SQL Dev are below</p>
  
  <p>username: jpathil
  Password: Jean1121
  hostname: coloplast-stg-rdb.cloud.modeln.com
  Port: 4004
  Service Name: CPHSTG</p>
  
  <p>What could be wrong with the code below?  It fails at the last line "oConOracle.Open strConOracle"</p>
  
  <pre><code>Sub QueryConstructOracle()
  Dim QueryVar As String
  Dim db As Database
  Dim rs As Recordset
  HOST$ = Sheets("Connection Setup").Range("Server")
  DBNAME$ = Sheets("Connection Setup").Range("Database")
  ORACLE_USER_NAME$ = Sheets("Connection Setup").Range("User")
  ORACLE_PASSWORD$ = Sheets("Connection Setup").Range("Password")
  ORACLE_PORT$ = Sheets("Connection Setup").Range("Port")
  sourcedb = Sheets("Connection Setup").Range("DataSource")
  Dim strConOracle As String
  Dim oConOracle, oRsOracle
  Dim strSQL As String
  On Error GoTo errHandler
  
  Application.Calculation = xlManual
  Application.ScreenUpdating = False
  
  
  ' Set connections
  strConOracle = "Provider=OraOLEDB.Oracle;Data Source=" &amp; sourcedb &amp; ":" &amp; ORACLE_PORT$ &amp; ":" &amp; DBNAME$ &amp; "; User ID=" &amp; ORACLE_USER_NAME$ &amp; ";Password=" &amp; ORACLE_PASSWORD$ &amp; ";"
  Set oConOracle = CreateObject("ADODB.Connection")
  oConOracle.Open strConOracle
  
  End Sub
  </code></pre>