简介:
WildFly,原名 JBoss AS(JBoss Application Server) 或者 JBoss,是一套应用程序服务器,属于开源的企业级 Java 中间件软件,用于实现基于 SOA 架构的 Web 应用和服务。 WildFly 包含一组可独立运行的软件。
GBase 8s(南大通用安全数据库管理系统),是具有完全自主知识产权的数据库产品,产品符合SQL92、ODBC、OLEDB、JDBC、ADO.NET等国际数据库规范和开发接口,参照国际主流数据库产品定义,提供完备的数据存储和数据管理功能
前置要求:
安装配置步骤
以下以windows为例,安装wildfly以及配置GBase 8s数据库连接
1, 下载并解压WildFly安装包
此次使用的版本是19.1.0.Final,下载地址:https://www.wildfly.org/downloads/
解压至D盘的wildfly-19.1.0.Final目录下
2, 为防止端口冲突,可以更改监听端口
修改D:\wildfly-19.1.0.Final\standalone\configuration路径下的配置文件standalone.xml,在socket-binding-group块中,按实际情况修改相应的端口。
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
<!-- 按实际情况修改相应的端口 -->
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
<socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
</socket-binding-group>
3, 添加管理员用户
执行D:\wildfly-19.1.0.Final\bin目录下的add-user.bat。Linux环境下执行add-user.sh。增加的用户名为webadmin,密码是GBase123
D:\wildfly-19.1.0.Final\bin>add-user.bat
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): <回车> # 管理用户
Enter the details of the new user to add.
Using realm 'ManagementRealm' as discovered from the existing property files.
Username : webadmin # 管理用户的用户名
Password recommendations are listed below. To modify these restrictions edit the
add-user.properties configuration file.
- The password should be different from the username
- The password should not be one of the following restricted values {root, admin, administrator}
- The password should contain at least 8 characters, 1 alphabetic character(s),1 digit(s), 1 non-alphanumeric symbol(s)
Password : GBase123 # 管理用户的密码
WFLYDM0102: Password should have at least 1 non-alphanumeric symbol.
Are you sure you want to use the password entered yes/no? yes # 接受密码
Re-enter Password : GBase123 # 管理用户的密码
What groups do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)[ ]: <回车> # 默认
About to add user 'webadmin' for realm 'ManagementRealm'
Is this correct yes/no? yes # 确认
Added user 'webadmin' to file 'D:\wildfly-19.1.0.Final\standalone\configuration\mgmt-users.properties'
Added user 'webadmin' to file 'D:\wildfly-19.1.0.Final\domain\configuration\mgmt-users.properties'
Added user 'webadmin' with groups to file 'D:\wildfly-19.1.0.Final\standalone\configuration\mgmt-groups.properties'
Added user 'webadmin' with groups to file 'D:\wildfly-19.1.0.Final\domain\configuration\mgmt-groups.properties'
Is this new user going to be used for one AS process to connect to another AS process?
e.g. for a slave host controller connecting to the master or for a Remoting connection for server to server EJB calls.
yes/no? yes # 确认
To represent the user add the following to the server-identities definition <secret value="R0Jhc2UxMjM=" />
请按任意键继续. . .
4, 为WildFly添加连接GBase 8s的jar包依赖
进入目录D:\wildfly-19.1.0.Final\modules,创建gbasedbt\main目录,之后将Gbase 8s的JDBC包dbtjdbc_2.0.1a2_1p_all.jar (该名称按实际的修改,默认是ifxjdbc.jar)复制到该文件夹,然后再在当前目录下创建配置文件module.xml ,内容如下:
<!-- name与目录名称对应 -->
<module xmlns="urn:jboss:module:1.1" name="gbasedbt" slot="main">
<resources>
<!-- 按实际情况修改该jdbc的jar包文件名 -->
<resource-root path="dbtjdbc_2.0.1a2_1p_all.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
5, 执行D:\wildfly-19.1.0.Final\bin目录下standalone.bat启动服务
管理端url地址http://127.0.0.1:9990/console,使用第3步设置的用户名密码登录(webadmin/GBase123)。
1)增加JDBC驱动
在Configuration – Subsystems – Datasource & Drivers – JDBC Drivers 中Add JDBC Driver
2)增加数据源
在Configuration – Subsystems – Datasource & Drivers –Datasources 中Add Datasource
使用自定义模板
指定Name及JNDI Name,其中JNDI Name使用java:jboss/ 与 name的字符串组合
指定驱动类型
指定数据库连接的URL,USER,PASSWORD
URL示例:
jdbc:gbasedbt-sqli://192.168.80.101:9088/testdb:GBASEDBTSERVER=gbase01;DB_LOCALE=zh_CN.utf8;CLIENT_LOCALE=zh_CN.utf8
重新检视数据源配置
6, 详细配置修改。
在Configuration – Subsystems – Datasource & Drivers –Datasources 中,选择gbasedbt数据库,view查看具体配置,并根据需要修改