1 package org.apache.turbine.services.db; 2 3 18 19 import java.sql.Connection ; 20 21 import org.apache.torque.Torque; 22 import org.apache.torque.adapter.DB; 23 import org.apache.torque.map.DatabaseMap; 24 import org.apache.turbine.util.TurbineException; 25 26 54 public abstract class TurbineDB 55 { 56 60 65 public static String getDefaultMap() 66 { 67 return Torque.getDefaultDB(); 74 } 75 76 83 public static DatabaseMap getDatabaseMap() throws TurbineException 84 { 85 try 86 { 87 return Torque.getDatabaseMap(); 88 } 89 catch (Exception ex) 90 { 91 throw new TurbineException(ex); 92 } 93 } 94 95 105 public static DatabaseMap getDatabaseMap(String name) 106 throws TurbineException 107 { 108 try 109 { 110 return Torque.getDatabaseMap(name); 111 } 112 catch (Exception ex) 113 { 114 throw new TurbineException(ex); 115 } 116 } 117 118 122 127 public static String getDefaultDB() 128 { 129 return Torque.getDefaultDB(); 136 } 137 138 145 public static Connection getConnection() throws Exception 146 { 147 return Torque.getConnection(); 148 } 149 150 167 public static Connection getConnection(String name) throws Exception 168 { 169 return Torque.getConnection(name); 170 } 171 172 178 public static void releaseConnection(Connection dbconn) throws Exception 179 { 180 Torque.closeConnection(dbconn); 181 } 182 183 187 194 public static DB getDB() throws Exception 195 { 196 return Torque.getDB(Torque.getDefaultDB()); 197 } 198 199 207 public static DB getDB(String name) throws Exception 208 { 209 return Torque.getDB(name); 210 } 211 } 212 | Popular Tags |