Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BookDbUtil {
- private final DataSource dataSource;
- // constructor
- public BookDbUtil() {
- try {
- /* TODO: przez adnotacje, albo jakos inaczej ladnie */
- Context initContext = new InitialContext();
- Context envContext = (Context) initContext.lookup("java:/comp/env");
- dataSource = (DataSource) envContext.lookup("sql2226123");
- } catch (NamingException e) {
- throw new IllegalStateException("Could not initialize database", e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement