title: how to set oracle JDBC database URL
body: <p>I am using an application which needs to access my oracle database to do some tasks with my data.</p>
  
  <p>That application needs two properties, which are:</p>
  
  <h3>d2rq:jdbcDSN</h3>
  
  <p>The JDBC database URL. This is a string of the form jdbc:subprotocol:subname. For a MySQL database, this is something like jdbc:mysql://hostname:port/dbname. <a href="http://www.devx.com/tips/Tip/28818" rel="nofollow">Examples for other databases</a> #</p>
  
  <h3>d2rq:jdbcDriver</h3>
  
  <p>The JDBC driver class name for the database. Used together with d2rq:jdbcDSN. Example: com.mysql.jdbc.Driver for MySQL. #</p>
  
  <p>I want to connect to an Oracle database that has this version</p>
  
  <pre><code>Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  PL/SQL Release 11.2.0.4.0 - Production
  "CORE   11.2.0.4.0  Production"
  TNS for Linux: Version 11.2.0.4.0 - Production
  NLSRTL Version 11.2.0.4.0 - Production
  </code></pre>
  
  <p>Normally I connect to my oracle database using a <code>SQL developer</code> application where I just set:</p>
  
  <ol>
  <li>Host Name</li>
  <li>Username and password</li>
  <li>Service Name</li>
  <li>Schema</li>
  </ol>
  
  <p>Now to connect to my database from this new app (now the sql developer), i am required to do (from this page <a href="http://www.devx.com/tips/Tip/28818" rel="nofollow">http://www.devx.com/tips/Tip/28818</a>)</p>
  
  <pre><code>jdbc:oracle:thin:@&lt;HOST&gt;:&lt;PORT&gt;:&lt;SID&gt;
  oracle.jdbc.driver.OracleDriver
  </code></pre>
  
  <p>so I changed that template to:</p>
  
  <pre><code>jdbc:oracle:think:@HostName:port:ServiceName
  </code></pre>
  
  <p>and I copied the  <code>ojdbc6.jar</code> to the bin folder</p>
  
  <p>when I run, i get this error:</p>
  
  <blockquote>
    <p>Database connection to jdbc:oracle:thin:@HostName:Porto:ServiceName failed (user: UserName): Listener refused the connection with the following error:
    ORA-12505, TNS:listener does not currently know of SID given in connect description</p>
  </blockquote>
  
  <p>It sounds like the SID should be be replaced by service name. (i am not sure) do you have any idea about how to solve it and if what I did is correct?</p>
  
  <h3>off course i hide the real database and host and password for privacy reasons so please execuse me </h3>