WSO2 api mgr mysql db

2019-09-12 20:21发布

问题:

i guess i'm not the only one trying to play with the new WSO2 API mgr. As explained in readme, i try to use mysql to store all data. I uploaded in the correct file the jdbc driver for mysql now the question is to change the setting in master-datasources.xml but the only example provided is in the readme file but only for mssql and i also never used jdbc ... using the mssql example in README what do you think of this setup customized for mysql :

    <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:jtds:mysql://db.mydomain.com:3306/USERDB</url>
                <username>USER</username>
                <password>USER</password>
                <driverClassName>net.sourceforge.jtds.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>
    </datasource>

回答1:

In the posted datasource configuration, I see you are using JTDS driver to connect to MySQL which is wrong. JTDS only support MSSQL and Sybase databases and therefore you have to use the MySQL JDBC driver in order to get the datasource configured properly to connect to a MySQL backend database. To do that, Download the MySQL JDBC driver from [1] and place it inside API_MANAGER_HOME/repository/component/lib folder and change the datasource configuration as shown below.

<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://hostname_or_ip:3306/database_name</url>
                <username>valid_mysql_username</username>
                <password>valid_mysql_password</password>
                <driverClassName>com.mysql.jdbc.Driver</driverClassName>
                <maxActive>50</maxActive>
                <maxWait>60000</maxWait>
                <testOnBorrow>true</testOnBorrow>
                <validationQuery>SELECT 1</validationQuery>
                <validationInterval>30000</validationInterval>
            </configuration>
        </definition>

Regards, Prabath

[1] http://dev.mysql.com/downloads/connector/j/



回答2:

I had the same issue and this page helped me: http://shavanthaw.blogspot.mx/2013/02/how-to-connect-wso2-is-server-to.html



标签: mysql jdbc wso2