Guest User

Untitled

a guest
Apr 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <datasource jndi-name="java:jboss/jdbc/exampleDS" pool-name="jdbc/exampleDS" enabled="true" use-java-context="true" use-ccm="true">
  2. <connection-url>jdbc:mysql://127.0.0.1:3306/example?useSSL=false</connection-url>
  3. <driver>mysql-connector-java-5.1.43-bin.jar</driver>
  4. <pool>
  5. <min-pool-size>10</min-pool-size>
  6. <max-pool-size>100</max-pool-size>
  7. <prefill>true</prefill>
  8. </pool>
  9. <security>
  10. <user-name>root</user-name>
  11. <password>password</password>
  12. </security>
  13. <validation>
  14. <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
  15. <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
  16. </validation>
  17. </datasource>
  18. <driver name="mysql-connector-java-5.1.43-bin.jar" module="com.mysql">
  19. <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>
  20. </driver>
  21.  
  22. <resource-ref>
  23. <description>example</description>
  24. <res-ref-name>jdbc/exampleDS</res-ref-name>
  25. <res-type>javax.sql.DataSource</res-type>
  26. <res-auth>Container</res-auth>
  27. </resource-ref>
  28.  
  29. private ServiceLocator() {
  30. try {
  31. this.initCtx = new InitialContext();
  32. this.envCtx = (Context) initCtx.lookup("java:comp/env");
  33. DataSource ds = (DataSource)
  34. envCtx.lookup("jdbc/exampleDS");
  35. } catch (NamingException e) {
  36. ApplicationException apRE = new ApplicationException(ErrorCode.E_JDNI001, e);
  37. LogService.getLog().fatal(apRE.getMessage(), apRE);
  38. throw apRE;
  39. }
  40. }
Add Comment
Please, Sign In to add comment