Configuring your OpenXava application to go against Informix is very
simple, basically you have to install the JDBC driver for Informix and
define correctly the datasource. You don't need to touch any code of your
application. Configuration for Informix
We assume you have already
installed and running Informix.
Download the JDBC driver for Informix
Download the Informix driver from here: https://www.ibm.com/products/informix/developer-tools
In that page choose the Informix JDBC option. It will ask you to register,
afterwards you will be able to download the driver. You will download a
file like this: ibm.jdbc.4.50.JC1.ALL.tar
(the version numbers may
vary). Uncompress it to find inside a file called setup.jar
have to execute it in this way:
It will run a classic install
wizard. Follow the wizard, it will copy some files in a folder of your
choice. Go to that folder, where you will find, inside a lib
folder, a file called ifxjdbc.jar. This last file, the .jar, is
the JDBC controller we're going to use.
Create a classpath variable in Eclipse
In order you can connect to Informix from Eclipse we're going to declare a
classpath variable that points to the Informix JDBC driver, so you can use
it in any project you need easily. For that, in Eclipse go to Window
> Preferences > Java > Build Path > Classpath Variables
where you can add the new variable:
You can call the variable
INFORMIX_DRIVER instead of DB_DRIVER if your prefer. The path is the path
of the JDBC driver, in our case the path of ifxjdbc.jar we have
Add the DB_DRIVER variable to your Eclipse project
In the project you're going to use Informix you have to add the variable
declared above. Click with right mouse button on your project and then
choose Java Build Path > Configure Build Path...
Then select the Libraries
With this we have the driver
available for the development environment.
Add the JDBC driver to the production Tomcat
the driver in production is much easier. Copy ifxjdbc.jar
to the lib folder of your Tomcat. Done.
Adjust your datasource definition
For development edit web/META-INF/context.xml of your Eclipse
project, and for production edit conf/context.xml of your Tomcat
to adjust the datasource to point to Informix, something like this:
<Resource name="jdbc/MyAppDS" auth="Container"
maxTotal="100" maxIdle="20" maxWaitMillis="10000"
The differences are the driverClassName
and the url. In the final part of the url (before
INFORMIXSERVER) you have the name of your database, myappdb in
this example. Obviously, instead of localhost you should put the
address of the server that hosts Informix, and also put the correct username
You don't need to touch the default
persistence unit of persistence.xml
), unless you use hibernate.dialect
property in which case just remove hibernate.dialect
However, you have to modify the junit
persistence unit to point to
<!-- JUnit Informix -->
<property name="hibernate.connection.driver_class" value="com.informix.jdbc.IfxDriver"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="ao49fmsk"/>
Adapt the username, password
and url to your Informix configuration.