1

my test.java is

public static main(String[] args)
{
    Connection connection =null;
    try{

         Class.forName("oracle.jdbc.driver.OracleDriver");
         long start=System.currentTimeMillis();
         connection = DriverManager.getConnection(DB_URL, USER,PASS);
         long stop=System.currentTimeMillis();
        System.out.println("connecting time:" +(stop-start));

     } catch (SQLException e) {
        e.printStackTrace();
     }
     finally{
       if(conn!=null)
         conn.close();
    }
  }

It takes time to connect more than 30 seconds in the second and third run , while less than 1 second in the first run. ie the first fast, the next slower. Do you have any idea about this. Thanks.

KittMedia
  • 7,368
  • 13
  • 34
  • 38
sozcu
  • 11
  • 2
  • I have no experience of this issue but [this question](http://stackoverflow.com/questions/5503063/oracle-getconnection-slow) looks related – Sabir Khan Apr 27 '16 at 07:27
  • It really depends on your driver version, so you should check the jdbc documentation. Do you experience the same on other type of DB / with other oracle JDBC driver (thin, oci, different versions) – HamoriZ Apr 27 '16 at 07:28
  • It might be helpful to know: your used operating system, the version of the JDBC driver, the version of the database. – SubOptimal Apr 27 '16 at 07:29
  • So the link posted by @SabirKhan was actually pointing to the right solution for your problem. – SubOptimal Apr 28 '16 at 07:47

1 Answers1

0

almost yeap. we add "haveged extra deamon". https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged

sozcu
  • 11
  • 2