title: How to resolve java.sql.SQLRecoverableException: IO Error: Connection timed out
body: <p>We have 13 application servers out of which for one application server when we are starting tomcat we are getting the </p>
  
  <blockquote>
    <p>SEVERE: Unable to create initial connections of pool. java.sql.SQLRecoverableException: IO Error: Connection timed out.caused by Caused by: java.net.SocketException: Connection timed out.</p>
  </blockquote>
  
  <p>we are not getting the error for the rest of the servers.
   so we wrote a java code to test the jdbc to find out whether the error is due to db connectivity or application. and we are getting the same error for the java code also.</p>
  
  <p>Things we did to check connectivity:</p>
  
  <ol>
  <li>Telnet is working to the Oracle database server</li>
  <li>Network team analysed the tcpdump and there is a successfull handshake between the app and database server</li>
  </ol>
  
  <p>Java Code:</p>
  
  <pre><code>import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.ResultSet;
  import java.sql.Statement;
  
  public class JdbcDemo {
      public static void main(String[] args){
      try{
  
          Class.forName("oracle.jdbc.driver.OracleDriver");
          System.out.println("COnnection started");
          Connection con = DriverManager.getConnection("jdbc:oracle:thin:@"+"db_ip"+":"+"1521"+"/"+"db_name","db_user","password");
          System.out.println("COnnection Established");
          //Statement st=con.createStatement();
          System.out.println("connection name"+con);
          //ResultSet rs=st.executeQuery("");
  
      }
      catch(Exception e){
  
           e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>Error we are getting:</p>
  
  <pre><code>root@app_server_ip # java -cp .:ojdbc7.jar JdbcDemo
  COnnection started
  java.sql.SQLRecoverableException: IO Error: Connection reset
          at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:841)
          at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:755)
          at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:38)
          at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:599)
          at java.sql.DriverManager.getConnection(DriverManager.java:664)
          at java.sql.DriverManager.getConnection(DriverManager.java:247)
          at JdbcDemo.main(JdbcDemo.java:13)
  Caused by: java.net.SocketException: Connection reset
          at java.net.SocketInputStream.read(SocketInputStream.java:209)
          at java.net.SocketInputStream.read(SocketInputStream.java:141)
          at oracle.net.ns.Packet.receive(Packet.java:317)
          at oracle.net.ns.DataPacket.receive(DataPacket.java:101)
          at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:301)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:245)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:167)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
          at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:119)
          at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:75)
          at oracle.jdbc.driver.T4CMAREngineStream.unmarshalUB1(T4CMAREngineStream.java:447)
          at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:706)
          at oracle.jdbc.driver.T4C8TTIdty.doRPC(T4C8TTIdty.java:611)
          at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:2161)
          at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:564)
          ... 6 more
  </code></pre>
  
  <p>App server: Red Hat Enterprise Linux Server release 6.8<br>
  Oracle Db version: oracle 11g </p>