SHARE
TWEET

Untitled

a guest Mar 24th, 2019 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Connection getConnection(String name) throws SQLException {
  2.         Connection connection=null;
  3.         try {
  4.             Context initContext = new InitialContext();
  5.             DataSource ds = (DataSource) initContext.lookup(name);
  6.             connection = ds.getConnection();
  7.         } catch (SQLException e) {
  8.             throw new SQLException("Connect "+name+ ", ErrorCode:" + e.getErrorCode() + ", Message:" + e.getMessage());
  9.         } catch (NamingException e) {
  10.             throw new SQLException("Connect "+name+ ", Message:" + e.getMessage());
  11.         }
  12.         return connection;
  13.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top