H2 Database cheatsheet

Here is a cheat sheet for H2 Database which shows some common Data definition, Data modification statements, JDBC Settings and H2 Database server administration. Firstly, if you are looking for an introduction to using H2 Database in your applications, then check this tutorial: H2 database tutorial DDL cheat sheet Table Creation (Basic) CREATE TABLE TEST(ID … Read more

How to inject a Datasource in your Enterprise applications

To inject a Datasource in your Enterprise applications you can use the javax.annotation.Resource annotation to declare a reference to that resource. The @Resource can decorate a class, a field, or a method. The container will inject the resource referred to by @Resource into the component either at runtime or after its initialization. In the following … Read more

How do you connect a Datasource to a Cluster ?

When connecting WildFly / JBoss EAP to a Database cluster you need to provide an appropriate JDBC Connection String. We’ll examine three popular Database: Oracle, MySQL and PostgreSQL. Oracle Real Application Clusters (RAC) Oracle Real Application Clusters (RAC) is a software component you can add to a high-availability solution that enables users on multiple machines … Read more

How to connect to a DataSource from a remote client?

WildFly and JBoss EAP 6/7 no longer support remote JNDI lookup of datasource objects. If you attempt to lookup a Datasource object from a remote client, the following error will be thrown: ERROR: org.jboss.remoting3.MessageCancelledException Exception in thread “main” org.jboss.naming.remote.protocol.NamingIOException: Failed to lookup [Root exception is java.io.NotSerializableException: org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] As an alternative, it is recommend using an … Read more

How to add Connection properties to your JBoss DataSource ?

In this article we will learn how to configure Connection Properties in a JBoss / WildFly Datasource. Let’s step back first. To configure Connection Pooling (non-XA) to a Database you have two options: Using a class which implements java.sql.Driver Using a class which implements javax.sql.DataSource When using a Class which implements java.sql.Driver, you can simply … Read more

JBoss run out of Connections ? here is how to fix it

Have you got No ManagedConnections available error message ? … javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/datasources/MyDataSource … javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms]) In this tutorial we will learn which are the possible causes to this problem. # 1  Your connection pool is too small Increase … Read more