compareSQLServerCost 查询起迄差

摘要:compareSQLServerCost 查询起迄差


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Date;


public class compareSQLServerCost {

/
* @param args
*/
public static void main(String[] args) {
//sqlServer  
String conUrl = "jdbc:sqlserver://10.12.208.114:1433;DatabaseName=afa;user=ydd;password=P@ssw0rd;"; //for jdbc 2.0
Connection con = null;
try {
//calc sqlserver time
Date d1 = new Date();
System.out.println("Start time====" +(d1.getTime())/1000);

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
con = DriverManager.getConnection(conUrl);
Statement stmt = con.createStatement();
ResultSet res = stmt.executeQuery("select * from YDD_RESOURCE_DESCRIPTION ");
stmt.close();
res.close();

Date d2 = new Date();
System.out.println("End time====" +(d2.getTime())/1000);
System.out.println("compare time 秒====" +(d2.getTime()-d1.getTime())/1000);
}
catch (Exception ex) {
   ex.printStackTrace();
}

}

}

原文:大专栏  compareSQLServerCost 查询起迄差


猜你喜欢

转载自www.cnblogs.com/chinatrump/p/11496767.html