Guest User

Untitled

a guest
Sep 9th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <Configure id="Server" class="org.eclipse.jetty.server.Server">
  2. <New id="myLocalDB" class="org.eclipse.jetty.plus.jndi.Resource">
  3. <Arg></Arg>
  4. <Arg>jdbc/myLocalDB</Arg>
  5. <Arg>
  6. <New class="org.apache.commons.dbcp2.BasicDataSource">
  7. <Set name="driverClassName">org.postgresql.Driver</Set>
  8. <Set name="url">jdbc:postgresql://localhost:5432/my_local_db</Set>
  9. <Set name="username">user</Set>
  10. <Set name="password">***</Set>
  11. <Set name="defaultAutoCommit">false</Set>
  12. </New>
  13. </Arg>
  14. </New>
  15. </Configure>
  16.  
  17. @Override
  18. public DataSource getJtaDataSource() {
  19. try {
  20. Context ctx = (Context) new InitialContext().lookup("java:jboss/datasources");
  21. return (DataSource) ctx.lookup("sensurisDB");
  22. } catch (NamingException e) {
  23. e.printStackTrace();
  24. return null;
  25. }
  26. }
Add Comment
Please, Sign In to add comment