Guest User

Untitled

a guest
Feb 22nd, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. long start = System.currentTimeMillis();
  2. PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
  3. System.out.println("getPoolDataSource: " + (System.currentTimeMillis() - start));
  4. start = System.currentTimeMillis();
  5. pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
  6. pds.setURL("jdbc:oracle:thin:@//oraclewin:1521/MyDB");
  7. pds.setUser("user");
  8. pds.setPassword("pass");
  9. pds.setInitialPoolSize(0);
  10. System.out.println("Init DataSource: " + (System.currentTimeMillis() - start));
  11. start = System.currentTimeMillis();
  12. Connection con1 = pds.getConnection();
  13. System.out.println("getConnection1: " + (System.currentTimeMillis() - start));
  14. start = System.currentTimeMillis();
  15. Connection con2 = pds.getConnection();
  16. System.out.println("getConnection2: " + (System.currentTimeMillis() - start));
  17.  
  18. getPoolDataSource: 451
  19. Init DataSource: 17
  20. getConnection1: 3008
  21. getConnection2: 123
  22.  
  23. getPoolDataSource: 2370
  24. getConnection1: 26795
  25. getConnection2: 10979
Add Comment
Please, Sign In to add comment