1 31 32 package org.opencms.db; 33 34 import java.sql.Connection ; 35 import java.sql.DriverManager ; 36 import java.sql.SQLException ; 37 import java.util.List ; 38 39 48 public class CmsSqlManager { 49 50 51 private CmsDriverManager m_driverManager; 52 53 56 protected CmsSqlManager() { 57 58 } 60 61 66 protected CmsSqlManager(CmsDriverManager driverManager) { 67 68 m_driverManager = driverManager; 69 } 70 71 78 public Connection getConnection(String dbPoolName) throws SQLException { 79 80 return getConnectionByUrl(CmsDbPool.DBCP_JDBC_URL_PREFIX + CmsDbPool.OPENCMS_URL_PREFIX + dbPoolName); 81 } 82 83 90 public Connection getConnectionByUrl(String dbPoolUrl) throws SQLException { 91 92 return DriverManager.getConnection(dbPoolUrl); 93 } 94 95 100 public List getDbPoolNames() { 101 102 return CmsDbPool.getDbPoolNames(m_driverManager.getConfigurations()); 103 } 104 105 110 public String getDefaultDbPoolName() { 111 112 return CmsDbPool.getDefaultDbPoolName(); 113 } 114 115 122 public int getActiveConnections (String dbPoolUrl) throws CmsDbException { 123 124 return m_driverManager.getActiveConnections(dbPoolUrl); 125 } 126 127 134 public int getIdleConnections (String dbPoolUrl) throws CmsDbException { 135 136 return m_driverManager.getIdleConnections(dbPoolUrl); 137 } 138 } | Popular Tags |