Wildfly 20에 Database(Mysql) 연결 - (3) > Middleware 자료실

본문 바로가기
사이트 내 전체검색

Middleware 자료실

JBoss Wildfly 20에 Database(Mysql) 연결 - (3)

페이지 정보

profile_image
작성자 MiddleM
댓글 0건 조회 328회 작성일 21-06-24 15:16

본문

3) Standalone 설정 파일 수정

[root@wildfly20 ~]# cd $WILDFLY_HOME/standalone/configuration/standalone.conf

====

            <datasources>

                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">

                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                    <driver>h2</driver>

                    <security>

                        <user-name>sa</user-name>

                        <password>sa</password>

                    </security>

                </datasource>

               

                <datasource jndi-name="java:jboss/MySqlDS" pool-name="MySqlDS" enabled="true" use-java-context="true" use-ccm="true">

                    <connection-url>jdbc:mysql://localhost:8080/characterEncoding=utf-8&amp;serverTimezone=UTC</connection-url>

                    <driver>mysql</driver>

                    <security>

                        <user-name>root</user-name>

                        <password>password</password>

                    </security>

                </datasource>

               

                                             <drivers>

                    <driver name="h2" module="com.h2database.h2">

                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                    </driver>

                </drivers>

 

                                             <drivers>

                    <driver name="mysql" module="com.mysql">

                        <driver-class>com.mysql.cj.jdbc.Driver</driver-class>

                        <xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>

                    </driver>

                </drivers>

            </datasources>

====


7. Wildfly Cli를 사용하여 확인

[root@wildfly20 ~]# cd $JBOSS_HOME/bin/


# 연결된 모든 datasource 확인

[root@wildfly20 ~]# ./jboss-cli.sh --connect --command="/subsystem=datasources:read-resource(recursive=true)" 


# 방금 추가한 datasource로 Connection 테스트

[root@wildfly20 ~]# ./jboss-cli.sh --connect --command="/subsystem=datasources/data-source=MysqlDS:test-connection-in-pool"


 


댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

사이트 정보

회사명 : (주)리눅스데이타시스템 / 대표 : 정정모
서울본사 : 서울특별시 강남구 봉은사로 114길 40 홍선빌딩 2층 / tel : 02-6207-1160
대전지사 : 대전광역시 유성구 노은로174 도원프라자 5층 / tel : 042-331-1161

접속자집계

오늘
482
어제
331
최대
680
전체
82,227
Copyright © www.linuxdata.org All rights reserved.