Tech-Today
Persist JMS message in a database in Glassfish
This tutorial will guide you on how to configure Java Messaging Service in Glassfish to store JMS message in a postgresql database.
What you need (configured and running):
1.) Glassfish 3.1.2.2
2.) Postgresql 9.1
3.) JMS Broker (integrated with Glassfish) set to LOCAL
Steps:
1.) Configure JMS property to persist JMS message in database by adding the following properties inside Glassfish admin, normally http://localhost:4848, go to Configurations->server-config->Java Message Service->
imq.persist.jdbc.postgresql.driver=org.postgresql.Driver
imq.instanceconfig.version=300
imq.persist.jdbc.postgresql.closedburl=jdbc\:postgresql\://localhost\:5432/ipieljms
imq.persist.jdbc.dbVendor=postgresql
imq.brokerid=ipiel
imq.jmsra.managed=true
imq.autocreate.reaptime=1
imq.persist.jdbc.postgresql.opendburl=jdbc\:postgresql\://localhost\:5432/ipieljms
imq.persist.jdbc.postgresql.needpassword=true
imq.persist.store=jdbc
imq.persist.jdbc.postgresql.password=ipiel
imq.persist.jdbc.postgresql.user=ipiel
*Don't forget to set JMS Service Type=LOCAL, in the same screen.
2.) Lastly don't forget to specify to JMS Broker, where the postgresql driver is located by modifying the file: /glassfish-3.1.2.2/mq/etc/imqenv.conf, and adding the line:
IMQ_DEFAULT_EXT_JARS=/glassfish-3.1.2.2/glassfish/domains/domain1/lib/postgresql-9.0-802.jdbc4.jar
Or where your postgresql jdbc jar is.
3.) Make sure that you have ipieljms schema in postgresql and user ipiel/ipiel has access to it.
4.) Restart Glassfish and after that you will notice that tables are created in ipieljms schema.
5.) You can now start sending your JMS message :-)
-
Database
MSSQLMSSQL equivalent of DESC in MYSQLPostgresqlChange postgresql's postgres passwordHow to install hstore in postgresql 9.1JDBC provider setting in java for postgresql, mysql and oracleHow to alter the sequence value in postgresqlOracleHow to change...
-
Jboss Datasource Configuration Settings
The following are sample configurations for different database (it's in the file standalone.xml subsystem=datasources): H2, postgresql, mysql <datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true"...
-
How To Setup Your Datasource In Jboss7.x
Below are sample configurations you can use to setup postgresq, mysql data source in your jboss7.x. Where to add: 1.) If you added Jboss Tools plugin to eclipse, in server view expand Jboss Server->Filesets->Configuration->standalone.xml 2.)...
-
How To Create A Connection Pool For Postgresql On Glassfish 3.1.1
This tutorial assumes that 1.) You already have Glassfish 3.1.1 installed. https://blogs.oracle.com/java/entry/glassfish_3_1_1 2.) Create and start a Glassfish domain a.) asadmin create-domain czetsuya b.) asadmin start-domain czetsuya...
-
How To Connect Mysql Or Postgresql Server From Java Using Jdbc Driver
How to connect MySql or PostgreSql Server from Java using JDBC Driver I think the best answer to this is through coding: private static Connection getConnection() { Connection conn = null; try { Class.forName("com.mysql.jdbc.Driver"); //conn = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/anime",...
Tech-Today