jboss7.1.1 설치 디렉터리를 ${jboss-dir}로 표기함.
mysql-jdbc: mysql-connector-java-5.1.18.jar
모듈 설치
1. ${jboss-dir}/modules 디렉터리에 com/mysql/main 하위 폴더를 생성한다.
2. ${jboss-dir}/modules/com/mysql/main 에 mysql-connector-java-5.1.18.jar 파일을 복사한다.
3. ${jboss-dir}/modules/com/mysql/main 에 module.xml 파일을 생성하여 아래와 같이 수정한다.
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.18.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
DataSource 설정
${jboss-dir}/standalone/configuation/standalone.xml 파일의 datasource 항목에 아래와 같이 추가한다.
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/MysqlDS" pool-name="MysqlDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
<driver>com.mysql</driver>
<security>
<user-name>dbuser</user-name>
<password>dbpasswd</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
댓글 없음:
댓글 쓰기