如何通过客户端连接到WSO2AM数据库?
How to connect to the WSO2 AM database thorugh client?
我是 WSO2 AM 的新手,正在研究以了解它的优点。好像是 "The default database of user manager is the H2 database that comes with WSO2 products. We can configure it to point to databases by other vendors such as IBM DB2, Oracle, MySQL using the scripts provided by WSO2 for installing and configuring relational databases".
- 我们如何将 WSO2 AM 连接到 MySQL 数据库?需要什么文件
变了? (我有兴趣使用 MySQL 而不是 H2 db)
- 我们如何使用外部客户端查看所有表格?
请您指导我。
以下示例在全新安装(初始启动之前)时效果更好:
- 将 Mysql jar connector/driver 放入 wso2am/repository/components/lib 目录。
- MySql 您将需要 2 个数据库:
mysql> create database reg_db;
mysql> create database am_db;
mysql> grant all on reg_db.* to dba@localhost identified by 'dba';
mysql> grant all on am_db.* to dba@localhost identified by 'dba';
mysql> flush privileges;
覆盖wso2am/repository/conf/datasources/master-datasources中的以下2个数据源。xml
<datasource>
<name>WSO2_CARBON_DB</name>
<description>The datasource used for registry and user manager</description>
<jndiConfig>
<name>jdbc/WSO2CarbonDB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration> <url>jdbc:mysql://localhost:3306/reg_db?autoReconnect=true&relaxAutoCommit=true&</url>
<username>dba</username>
<password>dba</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
<datasource>
<name>WSO2AM_DB</name>
<description>The datasource used for API Manager database</description>
<jndiConfig>
<name>jdbc/WSO2AM_DB</name>
</jndiConfig>
<definition type="RDBMS">
<configuration> <url>jdbc:mysql://localhost:3306/am_db?autoReconnect=true&relaxAutoCommit=true&</url>
<username>dba</username>
<password>dba</password>
<driverClassName>com.mysql.jdbc.Driver</driverClassName>
<maxActive>50</maxActive>
<maxWait>60000</maxWait>
<testOnBorrow>true</testOnBorrow>
<validationQuery>SELECT 1</validationQuery>
<validationInterval>30000</validationInterval>
<defaultAutoCommit>false</defaultAutoCommit>
</configuration>
</definition>
</datasource>
使用 wso2server.sh -Dsetup 或 wso2server.bat -Dsetup
启动服务器
我是 WSO2 AM 的新手,正在研究以了解它的优点。好像是 "The default database of user manager is the H2 database that comes with WSO2 products. We can configure it to point to databases by other vendors such as IBM DB2, Oracle, MySQL using the scripts provided by WSO2 for installing and configuring relational databases".
- 我们如何将 WSO2 AM 连接到 MySQL 数据库?需要什么文件 变了? (我有兴趣使用 MySQL 而不是 H2 db)
- 我们如何使用外部客户端查看所有表格?
请您指导我。
以下示例在全新安装(初始启动之前)时效果更好:
- 将 Mysql jar connector/driver 放入 wso2am/repository/components/lib 目录。
- MySql 您将需要 2 个数据库:
mysql> create database reg_db; mysql> create database am_db; mysql> grant all on reg_db.* to dba@localhost identified by 'dba'; mysql> grant all on am_db.* to dba@localhost identified by 'dba'; mysql> flush privileges;
覆盖wso2am/repository/conf/datasources/master-datasources中的以下2个数据源。xml
<datasource> <name>WSO2_CARBON_DB</name> <description>The datasource used for registry and user manager</description> <jndiConfig> <name>jdbc/WSO2CarbonDB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/reg_db?autoReconnect=true&relaxAutoCommit=true&</url> <username>dba</username> <password>dba</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> <defaultAutoCommit>false</defaultAutoCommit> </configuration> </definition> </datasource> <datasource> <name>WSO2AM_DB</name> <description>The datasource used for API Manager database</description> <jndiConfig> <name>jdbc/WSO2AM_DB</name> </jndiConfig> <definition type="RDBMS"> <configuration> <url>jdbc:mysql://localhost:3306/am_db?autoReconnect=true&relaxAutoCommit=true&</url> <username>dba</username> <password>dba</password> <driverClassName>com.mysql.jdbc.Driver</driverClassName> <maxActive>50</maxActive> <maxWait>60000</maxWait> <testOnBorrow>true</testOnBorrow> <validationQuery>SELECT 1</validationQuery> <validationInterval>30000</validationInterval> <defaultAutoCommit>false</defaultAutoCommit> </configuration> </definition> </datasource>
使用 wso2server.sh -Dsetup 或 wso2server.bat -Dsetup
启动服务器