scotty92

Untitled

Oct 17th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. package varekd.io;
  2.  
  3. import java.io.File;
  4. import java.sql.Connection;
  5. import java.sql.SQLException;
  6. import snaq.db.ConnectionPoolManager;
  7. import varekd.util.Logger;
  8.  
  9. public class DBConnection {
  10. private static ConnectionPoolManager pool = null;
  11.  
  12. public static Connection getConnection(String s) throws SQLException {
  13. return pool.getConnection(s);
  14. }
  15.  
  16. public static boolean loadDBConnectionPool() {
  17. try{
  18. Class.forName("com.mysql.jdbc.Driver");
  19. if(pool != null) {
  20. pool.release();
  21. }
  22. pool = ConnectionPoolManager.getInstance(new File("conf/", "dbpool.properties"));
  23. return true;
  24. } catch(Exception e) {
  25. Logger.err(e);
  26. }
  27. return false;
  28. }
  29.  
  30. static {
  31.  
  32. }
  33.  
  34. /*public static int getNumIdle() { return dataSource.getNumIdle(); }
  35. public static int getNumActive() { return dataSource.getNumActive(); }*/
  36. }
Add Comment
Please, Sign In to add comment