title: The most precision way to get connection time JDBC
body: <pre><code>public class Sql {
      private static Connection con=null;
      private static Statement stat=null;
  
      public void createConnection(){
          try {
              long a = System.currentTimeMillis();
              con = DriverManager.getConnection("jdbc:mysql://localhost:3306/","root","");
              stat = con.createStatement();
              //result in milliseconds
              System.out.println(System.currentTimeMillis() - a); 
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>it is piece of code which provide us connection to localhost source. i create there method which giving result of time taken to connect using System.currentTimeMillis(). is there any other way to get more precision value?</p>