Using mysql with WSO2 WSAS

Step #1: After connecting to the server as root, you can add new accounts. The following statements use GRANT to set up two new accounts:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'wso2wsas'@'localhost'
-> IDENTIFIED BY 'wso2wsas' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'wso2wsas'@'%'
-> IDENTIFIED BY 'wso2wsas' WITH GRANT OPTION;

Step #2: Please replace the following section in WSAS_HOME/conf/wso2wsas.hibernate.cfg.xml

        <!-- Database connection settings -->
        <property name="connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
        <property name="connection.url">jdbc:derby:../database/WSO2WSAS_DB</property>
        <property name="connection.username">wso2wsas</property>
        <property name="connection.password">wso2wsas</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.DerbyDialect</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">false</property>

        <!-- Posible values for hbm2ddl.auto (update | create | create-drop)-->
        <!--<property name="hbm2ddl.auto">create</property>-->
with the following
        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://my_remote_box/wsas_db</property>
        <property name="connection.username">wso2wsas</property>
        <property name="connection.password">wso2wsas</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">1</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">false</property>

        <!-- Posible values for hbm2ddl.auto (update | create | create-drop)-->
        <property name="hbm2ddl.auto">create</property>
Basically we made the following changes:
  • Set com.mysql.jdbc.Driver as the connection.driver_class
  • Set jdbc:mysql://my_remote_box/wsas_db as the connection.url. Please use the ip address of your box instead of my_remote_box
  • Switched dialect to org.hibernate.dialect.MySQLDialect
  • Switched on the hbm2ddl.auto flag by setting it to create. This will enable hibernate to create the tables
  • If you chose another login id / password, please specify connection.username and connection.password appropriately

Step #3: Run "wso2-wsas run" as usual. That's it.

library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)