Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <datasource jndi-name="java:jboss/jdbc/exampleDS" pool-name="jdbc/exampleDS" enabled="true" use-java-context="true" use-ccm="true">
- <connection-url>jdbc:mysql://127.0.0.1:3306/example?useSSL=false</connection-url>
- <driver>mysql-connector-java-5.1.43-bin.jar</driver>
- <pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>100</max-pool-size>
- <prefill>true</prefill>
- </pool>
- <security>
- <user-name>root</user-name>
- <password>password</password>
- </security>
- <validation>
- <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
- <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
- </validation>
- </datasource>
- <driver name="mysql-connector-java-5.1.43-bin.jar" module="com.mysql">
- <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlDataSource</xa-datasource-class>
- </driver>
- <resource-ref>
- <description>example</description>
- <res-ref-name>jdbc/exampleDS</res-ref-name>
- <res-type>javax.sql.DataSource</res-type>
- <res-auth>Container</res-auth>
- </resource-ref>
- private ServiceLocator() {
- try {
- this.initCtx = new InitialContext();
- this.envCtx = (Context) initCtx.lookup("java:comp/env");
- DataSource ds = (DataSource)
- envCtx.lookup("jdbc/exampleDS");
- } catch (NamingException e) {
- ApplicationException apRE = new ApplicationException(ErrorCode.E_JDNI001, e);
- LogService.getLog().fatal(apRE.getMessage(), apRE);
- throw apRE;
- }
- }
Add Comment
Please, Sign In to add comment