title: How to connect to Oracle using Service Name instead of SID
body: <p>I have a Java application that uses JDBC (via JPA) that was connecting to a development database using hostname, port and Oracle SID, like this:</p>
  <pre class="lang-none prettyprint-override"><code>jdbc:oracle:thin:@oracle.hostserver1.mydomain.ca:1521:XYZ
  </code></pre>
  <p>XYZ was the Oracle SID. Now I need to connect to a different Oracle database that does not use a SID, but uses an Oracle &quot;Service Name&quot; instead.</p>
  <p>I tried this but it doesn't work:</p>
  <pre class="lang-none prettyprint-override"><code>jdbc:oracle:thin:@oracle.hostserver2.mydomain.ca:1522:ABCD
  </code></pre>
  <p>ABCD is the Service Name of the other database.</p>
  <p>What am I doing wrong?</p>