title: How to connect JDBC to tns oracle
body: <p>I can connect from plsql to database using tns file</p>
  
  <p>Now I want to connect to the database from my Java using JDBC.</p>
  
  <h3>What I tried:</h3>
  
  <p>I search google and I find that I have to using this connection String:</p>
  
  <pre><code>"jdbc:oracle:thin:@//host:port))/tnsfile)";
  </code></pre>
  
  <p>My computer name is <strong>myPC</strong></p>
  
  <p>The port that is written in the tnsfile is <strong>5151</strong></p>
  
  <p>So I tried this connection String</p>
  
  <pre><code>"jdbc:oracle:thin:@//myPC:5151))/tnsfile"
  </code></pre>
  
  <p>but I got this Exception</p>
  
  <pre><code>java.sql.SQLRecoverableException: IO ERROR: SO Exception was generated
  </code></pre>
  
  <h3>What am I doing wrong?</h3>
  
  <h3>How to connect my JDBC to the database using tns file?</h3>