You are on page 1of 5

How to Configure EMS 5.x Server with Database Datastore?

EMS 5.x can be configured to use a database to store messages. The following
steps have been tested on a Windows host to configure EMS 5.x with a databa
se. For other platforms, the steps will be similar.

Setup Steps:
1. Install EMS 5.x
2. Download and install JDK 1.5 or later
3. Download and install Hibernate from the link provided at the EMS 5.x down
load on http:
download.tibco.com.
4. Download the corresponding database JDBC drivers. They can be found on th
e Internet. The corresponding jar files for the JDBC need to be added to
dbstore_classpath in EMS main configuration file.
For example:
1). MySQL InnoDB
MySQL Connector:
mysql-connector-java-5.0.6-bin.jar
2). Microsoft SQL Server
Microsoft JDBC Driver for SQL Server:
sqljdbc.jar
3). Oracle 9i and 10g
Oracle JDBC Thin Driver:
ojdbc14.jar or ojdbc5.jar
4). IBM DB2 Server 8.1 and 9.1
DB2 Universal JDBC Driver:
db2jcc.jar and db2jcc_license_cu.jar
5. Modify the sample EMS main configuration file used for database: c:\t
ibco\ems\5.0\samples\config\tibemsd-db.conf:
Modify the variables: dbstore_classpath, dbstore_driver_name, dbstore_driver
_dialect, jar_library to reflect your own settings and database.
Here is an example which uses the Oracle 10g database:
==============================================
dbstore_classpath = c:\tibco\components\eclipse\plugins\com.tibco.tpcl.org.h
ibernate_3.2.5.001\hibe rnate3.jar;c:\tibco\components\eclipse\plugins\com.tibco
.tpcl.org.com.mchange.c3 p0_0.9.1.001\c3p0-0.9.1.jar;c:\tibco\EMS\5.0\bin\antlr-
2.7.6.jar;c:\tibco\EMS\5. 0\bin\asm-attrs.jar;c:\tibco\EMS\5.0\bin\asm.jar;c:\ti
bco\EMS\5.0\bin\cglib-2.1. 3.jar;c:\tibco\EMS\5.0\bin\commons-collections-2.1.1.
jar;c:\tibco\EMS\5.0\bin\co mmons-logging-1.0.4.jar;c:\tibco\EMS\5.0\bin\dom4j-1
.6.1.jar;c:\tibco\EMS\5.0\bi n\ehcache-1.2.3.jar;c:\tibco\EMS\5.0\bin\jta.jar;C:
\tibco\EMS\5.0\databaselib\oj dbc14.jar;C:\tibco\EMS\5.0\bin\ojdbc14.jar
dbstore_driver_name = oracle.jdbc.driver.OracleDriver
dbstore_driver_dialect = org.hibernate.dialect.Oracle10gDialect
jre_library = C:\jdk1.5.0_06\jre\bin\server\jvm.dll
==============================================
6. Create database users for EMS usage in the database. The users should hav
e permissions to create, alter, delete, update for table, index and sequ
ence.
7. Modify c:\tibco\ems\5.0\samples\config\stores-db.conf to put your own
database store information:
Example, in stores-db.conf, defines oracle database information:
$sys.failsafe
type=dbstore
dbstore_driver_url=jdbc:oracle:thin:adminfs/admin123@//osrv_1:1521/orclperf
dbstore_driver_username=adminfs
dbstore_driver_password=admin123
8. Modify the file queues.conf or topics.conf to define where the messages w
ill be stored:
Example, in the file queues.conf:
TIBCO.quotes maxbytes=10MB,trace,store=$sys.failsafe
9. Use the schema export tool to export the EMS schema into database:
Example:
java -jar c:\tibco\ems\5.0\bin\tibemsd_util.jar -tibemsdconf c:\tibco\em
s\5.0\samples\config\tibemsd-db.conf -createall -export
See the TIBCO Enterprise Message Service Users Guide, Chapter 5, entitled "Ru
nning the EMS Server" for details about the schema export tool.
10. Start the EMS server using c:\tibco\ems\5.0\samples\config\tibemsd-db.co
nf

Known Issues:
1. If you want to start the EMS 64 daemon, you need to use a 64 bit JVM, oth
erwise the EMS server will fail to launch. When using a database as datastor
e to obtain more debug information make sure "log_trace" in the EMS main
configuration file is set to the following trace options:
"DEFAULT,CONNECT,JVM,JVMERRDBSTORE"
2. If you import the EMS schema into the Oracle 9i database, you may get fol
lowing warning message:

Aug 7, 2008 11:56:45 AM com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1P
ooledConnectionResourcePool Manager destroyResource
WARNING: An exception occurred while executing the onDestroy() method of
com.tibco.tibems.tibemsd.internal.db.DataStoreConnectionCustomizer@46b90a.
c3p0 will attempt to destroy the target Connection regardless, but this issu
e should be investigated and fixed.
java.lang.NullPointerException
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:237
)
at oracle.jdbc.driver.T4CConnection.doCommit(T4CConnection.java:533)
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1119
)
at com.tibco.tibems.tibemsd.internal.db.DataStoreConnectionCustomizer.onDest
roy(Da taStoreConnectionCustomizer.java:72)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResour
cePool Manager.destroyResource(C3P0PooledConnectionPool.java:448)
at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(Ba
sicRes ourcePool.java:964)
at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResour
cePool .java:989)
at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourc
ePool. java:1406)
at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourc
ePool. java:1378)
at com.mchange.v2.resourcepool.BasicResourcePool.access$300(BasicResourcePoo
l.java :32)
at com.mchange.v2.resourcepool.BasicResourcePool$1RefurbishCheckinResourceTa
sk.run (BasicResourcePool.java:1245)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPo
olAsyn chronousRunner.java:547)

This is an Oracle JDBC driver issue and has has been fixed by Oracle JDBC Dr
iver (ojdbc5.jar). This warning should not cause any problems when creat
ing and exporting the schema.
-------------------
Database storage in TIBCO EMS 5.0
Oct 10th, 2008
by Haritza Zubillaga.
Earlier this year TIBCO released a new version of their particular implementatio
n of the JMS standard. TIBCO Enterprise Message Service 5.0 which, among others,
includes some features which I personally consider very interesting.
One of them is the possibility to store persistent messages in a database. In pr
evious versions, the only possibility was to use file based storage. In case you
wanted to use fault tolerant groups of servers, this caused some difficulties a
s having both the messages and the shared state information in files required th
em to be in a shared storage device, either via hardware (SCSI and SAN, NAS or N
AS with NFS) or software (Cluster Server or Clustered File System). These soluti
ons are expensive and hard to maintain while using a database eases the configur
ation and leaves the hard work on the DBMS. You can even combine file and databa
se based storage depending on the queue or topic.
Database storage is based in Hibernate, so any database server supported by Hibe
rnate could be used to store the data. To use it, first we will need to enable i
t, setting the following parameters in the tibemsd.conf file:
dbstore_classpath: pointing to the hibernate and DB driver jar files.
dbstore_driver_name: specifies the jdbc driver.
dbstore_driver_dialect: specifies the hibernate driver dialect.
jre_library: associated JVM libraries.
Second, we will have to create the stores in the stores.conf file, for example:
[TSLstore]
type=dbstore
dbstore_driver_url=jdbc:mysql:thin:localhost:3306:TSLDB
dbstore_driver_username=anonymous
dbstore_driver_password=anonymous
Third, link the destinations with the appropriate store, either in the topics.co
nf and queues.conf files or using the command line administration tool with the
setprop command, e.g.
setprop topic my.topic store=dbstore
Finally, we will need to export the EMS database tables using the EMS Schema exp
ort tool provided with EMS:
java -jar <EMS_home>/bin/tibemsd_util.jar -tibemsdconf <route_to_tibemds.conf>/t
ibemsd.conf -createall -export
As a postscript, let me recommend you not to install EMS as root, at least in a
Solaris machine. With EMS 5.0 version it will not work unless you change the own
er after the installation. This happens because once installed, if we try to run
in as root, Solaris, due to security reasons, will execute the process with the
user nobody4 but the folder which will contain the datastore files (if we choos
e file-based storage) will have write permissions set only for root user. As EMS
will not be able to create the datastores, it will automatically shutdown. More
over, even if we change the rights of that folder we will have the same problem
with the configuration files, they will only have write permissions for root use
r which will return errors if we try to change the configuration using the comma
nd line administration tool.
Posted in: EAI, TIBCO.
Tagged: EMS JMS TIBCO

You might also like