Guest User

Untitled

a guest
Apr 12th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. public class DataSourceWrapper implements DataSource {
  2.  
  3. private final DataSource dataSource;
  4. private final String username;
  5. private final String password;
  6.  
  7. public DataSourceWrapper(DataSource dataSource, String username, String password) {
  8. this.dataSource = dataSource;
  9. this.username = username;
  10. this.password = password;
  11. }
  12.  
  13. public Connection getConnection() throws SQLException {
  14. return dataSource.getConnection(username, password);
  15. }
  16.  
  17. public Connection getConnection(String username, String password)
  18. throws SQLException {
  19. return dataSource.getConnection(username, password);
  20. }
  21.  
  22. public PrintWriter getLogWriter() throws SQLException {
  23. return dataSource.getLogWriter();
  24. }
  25.  
  26. public int getLoginTimeout() throws SQLException {
  27. return dataSource.getLoginTimeout();
  28. }
  29.  
  30. public void setLogWriter(PrintWriter out) throws SQLException {
  31. dataSource.setLogWriter(out);
  32. }
  33.  
  34. public void setLoginTimeout(int seconds) throws SQLException {
  35. dataSource.setLoginTimeout(seconds);
  36. }
  37.  
  38. }
Add Comment
Please, Sign In to add comment