All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.ussd.docs.adminguide.restcomm-ussd-adminguide-sources-asciidoc.7.1.57.source-code.Appendix-Configuring_MySQL_Database.adoc Maven / Gradle / Ivy

There is a newer version: 7.1.63
Show newest version

:sectnums!:

[appendix]
[[_configuring_mysql]]
= Configuring MySQL as datasource

If you configure the Gateway to log CDR to a Database, then every transaction of the Gateway is logged in the HSQLDB that comes bundled with JBoss AS and leverages the JBoss AS DataSource.
However this is only made available to allow the platform to run "out of the box". You must configure a production ready Database prior to using the Gateway in a production environment.
 

{this-platform} {this-application} has been tested with PostgreSQL and MySQL.
In this section, you will find instructions for configuring MySQL database for CDR logging. 

.Procedure: Configuring MySQL as datasource for CDR logging
. Install MySQL and create a database where CDR data will be stored.
  In this example, a database named "test" is assumed to have been created. 
. Copy the MySQL connector library ([path]_mysql-connector-java-5.1.27-bin.jar_) from "Connector/J" in the MySQL library into library folder of the JBoss Server ([path]_{this-folder}-ussdgateway-/jboss-5.1.0.GA/server//lib_). 
. The example HSQLDB DataSource is bound to the JNDI name java:/DefaultDS and its descriptor is available in the file [path]_mobicents-ussdgateway-/jboss-5.1.0.GA/server//deploy/hsqldb-ds.xml_.
  You must delete this datasource by removing this descriptor file. 
. Copy the descriptor file for MySQL, [path]_mysql-ds.xml_, from [path]_{this-folder}-ussdgateway-/jboss-5.1.0.GA/docs/examples/jca/_ into  [path]_{this-folder}-ussdgateway-/jboss-5.1.0.GA/server//deploy/_. 
. Update the MySQL descriptor file, [path]_mysql-ds.xml_, as required to suit your configuration.
Below is an example configuration.
You must update the tags  with the host where a database can be found ('localhost' in this example) and the database name ('test' in this example). You must also update the username and password tags ('root' and '111111' in this example). 
+
----






MySqlDS 
jdbc:mysql://localhost:3306/test
com.mysql.jdbc.Driver
root
111111
org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker





mySQL



----
+
. Delete the HSQLDB file for messaging persistence [path]_{this-folder}-ussdgateway/jboss-5.1.0.GA/server//deploy/messaging/hsqldb-persistence-service.xml_. 
. Copy the MySQL file for messaging persistence, [path]_mysql-persistence-service.xml_, from [path]_{this-folder}-ussdgateway/jboss-5.1.0.GA/docs/examples/jms/_ into  [path]_{this-folder}-ussdgateway/jboss-5.1.0.GA/server//deploy/messaging_. 
. Update the below files to replace all "DefaultDS" values with "MySqlDS" in all occurrences in all these files. 

* [path]_messaging/mysql-persistence-service.xml_		
* [path]_messaging/messaging-jboss-beans.xml_		
* [path]_ejb2-timer-service.xml_		
* [path]_schedule-manager-service.xml_		
* [path]_uuid-key-generator.sar/META-INF/jboss-service.xml_			  
. Open the file [path]_messaging/mysql-persistence-service.xml_, go the mbean definition  and locate the line false. Leave this attribute and comment out or remove all the lines after this till the end of this bean.
  Save all changes. 
. Open the file [path]_{this-folder}-ussdgateway/jboss-5.1.0.GA/server//deploy/{this-folder}-slee/META-INF/jboss-beans.xml_ and locate the following bean: 
+
----

.....
.....

----
+
. Add the following bean with properties as specified below:  
+
----

true
false
java:/MySqlDS
org.hibernate.dialect.MySQLDialect

----	
+
. In the [path]_jboss-beans.xml_, comment out or remove the following blocks: 
+
----

................


................

----	
+
. In the [path]_jboss-beans.xml_, go to the Profile Management section and replace HSQLDBConfig with MySQLDBConfig as shown below. 
+
----

....replace

....with

----	
+
. You must note that `mobicents-slee-ra-jdbc-DU-6.1.1.GA-Mobicents.jar` also refers to DataSource name.
  You must change the value of `DATASOURCE_JNDI_NAME` (which is hardcoded in the library) in the file [path]_{this-folder}-ussdgateway-/jboss-5.1.0.GA/server//deploy/mobicents-slee-ra-jdbc-DU-6.1.1.GA-Mobicents.jar/jars/mobicents-slee-ra-jdbc-ra-6.1.1.GA-Mobicents.jar/META-INF/resource-adaptor-jar.xml_ to `java:MySqlDS`. 
. Delete all tables from the MySql database you wish to use. 
. When you run the Gateway now, you will find the `ussd_gw_cdrs` tables where all CDR will be stored. 

:sectnums:




© 2015 - 2025 Weber Informatics LLC | Privacy Policy