1 27 28 32 package xeus.bottomline; 33 34 import java.net.MalformedURLException ; 35 import java.net.URL ; 36 import java.net.URLClassLoader ; 37 import java.sql.CallableStatement ; 38 import java.sql.Connection ; 39 import java.sql.DatabaseMetaData ; 40 import java.sql.Driver ; 41 import java.sql.PreparedStatement ; 42 import java.sql.SQLException ; 43 import java.sql.SQLWarning ; 44 import java.sql.Savepoint ; 45 import java.sql.Statement ; 46 import java.util.Map ; 47 import java.util.Properties ; 48 49 import xeus.bottomline.exception.BottomlineException; 50 51 55 public class BottomlineConnection implements Connection { 56 57 private Connection conn; 58 59 65 public BottomlineConnection(String url, Properties props) 66 throws BottomlineException, SQLException { 67 Driver driver = null; 68 try { 69 URL u = new URL ("jar:file:/"+props 70 .getProperty(BottomlineConstants.DRIVER_JAR)+"!/"); 71 URLClassLoader ucl = new URLClassLoader (new URL [] { u }); 72 driver = (Driver ) Class.forName( 73 props.getProperty(BottomlineConstants.DRIVER_CLASS), true, 74 ucl).newInstance(); 75 } catch (InstantiationException e) { 76 throw new BottomlineException(e); 77 } catch (IllegalAccessException e) { 78 throw new BottomlineException(e); 79 } catch (ClassNotFoundException e) { 80 throw new BottomlineException(e); 81 } catch (MalformedURLException e) { 82 throw new BottomlineException(e); 83 } 84 85 conn = driver.connect(url.replaceFirst("jdbc:bottomline:", "jdbc:"), 86 props); 87 } 88 89 92 public Connection getUnderlayingConnection() { 93 return conn; 94 } 95 96 101 public Statement createStatement() throws SQLException { 102 return conn.createStatement(); 103 } 104 105 110 public PreparedStatement prepareStatement(String arg0) throws SQLException { 111 return conn.prepareStatement(arg0); 112 } 113 114 119 public CallableStatement prepareCall(String arg0) throws SQLException { 120 return conn.prepareCall(arg0); 121 } 122 123 128 public String nativeSQL(String arg0) throws SQLException { 129 return conn.nativeSQL(arg0); 130 } 131 132 137 public void setAutoCommit(boolean arg0) throws SQLException { 138 conn.setAutoCommit(arg0); 139 } 140 141 146 public boolean getAutoCommit() throws SQLException { 147 return conn.getAutoCommit(); 148 } 149 150 155 public void commit() throws SQLException { 156 conn.commit(); 157 } 158 159 164 public void rollback() throws SQLException { 165 conn.rollback(); 166 } 167 168 173 public void close() throws SQLException { 174 conn.close(); 175 } 176 177 182 public boolean isClosed() throws SQLException { 183 return conn.isClosed(); 184 } 185 186 191 public DatabaseMetaData getMetaData() throws SQLException { 192 return conn.getMetaData(); 193 } 194 195 200 public void setReadOnly(boolean arg0) throws SQLException { 201 conn.setReadOnly(arg0); 202 } 203 204 209 public boolean isReadOnly() throws SQLException { 210 return conn.isReadOnly(); 211 } 212 213 218 public void setCatalog(String arg0) throws SQLException { 219 conn.setCatalog(arg0); 220 } 221 222 227 public String getCatalog() throws SQLException { 228 return conn.getCatalog(); 229 } 230 231 236 public void setTransactionIsolation(int arg0) throws SQLException { 237 conn.setTransactionIsolation(arg0); 238 } 239 240 245 public int getTransactionIsolation() throws SQLException { 246 return conn.getTransactionIsolation(); 247 } 248 249 254 public SQLWarning getWarnings() throws SQLException { 255 return conn.getWarnings(); 256 } 257 258 263 public void clearWarnings() throws SQLException { 264 conn.clearWarnings(); 265 } 266 267 272 public Statement createStatement(int arg0, int arg1) throws SQLException { 273 return conn.createStatement(arg0, arg1); 274 } 275 276 281 public PreparedStatement prepareStatement(String arg0, int arg1, int arg2) 282 throws SQLException { 283 return conn.prepareStatement(arg0, arg1, arg2); 284 } 285 286 291 public CallableStatement prepareCall(String arg0, int arg1, int arg2) 292 throws SQLException { 293 return conn.prepareCall(arg0, arg1, arg2); 294 } 295 296 301 public Map getTypeMap() throws SQLException { 302 return conn.getTypeMap(); 303 } 304 305 309 public void setTypeMap(Map arg0) throws SQLException { 310 conn.setTypeMap(arg0); 311 } 312 313 318 public void setHoldability(int arg0) throws SQLException { 319 conn.setHoldability(arg0); 320 } 321 322 327 public int getHoldability() throws SQLException { 328 return conn.getHoldability(); 329 } 330 331 336 public Savepoint setSavepoint() throws SQLException { 337 return conn.setSavepoint(); 338 } 339 340 345 public Savepoint setSavepoint(String arg0) throws SQLException { 346 return conn.setSavepoint(arg0); 347 } 348 349 354 public void rollback(Savepoint arg0) throws SQLException { 355 conn.rollback(arg0); 356 } 357 358 363 public void releaseSavepoint(Savepoint arg0) throws SQLException { 364 conn.releaseSavepoint(arg0); 365 } 366 367 372 public Statement createStatement(int arg0, int arg1, int arg2) 373 throws SQLException { 374 return conn.createStatement(arg0, arg1, arg2); 375 } 376 377 383 public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, 384 int arg3) throws SQLException { 385 return conn.prepareStatement(arg0, arg1, arg2, arg3); 386 } 387 388 393 public CallableStatement prepareCall(String arg0, int arg1, int arg2, 394 int arg3) throws SQLException { 395 return conn.prepareCall(arg0, arg1, arg2, arg3); 396 } 397 398 403 public PreparedStatement prepareStatement(String arg0, int arg1) 404 throws SQLException { 405 return conn.prepareStatement(arg0, arg1); 406 } 407 408 413 public PreparedStatement prepareStatement(String arg0, int[] arg1) 414 throws SQLException { 415 return conn.prepareStatement(arg0, arg1); 416 } 417 418 424 public PreparedStatement prepareStatement(String arg0, String [] arg1) 425 throws SQLException { 426 return conn.prepareStatement(arg0, arg1); 427 } 428 } 429 | Popular Tags |