IIUG Insider (Issue #124) October 2010

Highlights: IBM releases Informix Dynamic Server 11.70

Welcome to the International Informix Users Group (IIUG) Insider! Designed for IIUG members and Informix user group leaders, this publication contains timely and relevant information for the IBM Informix community.

Contents:

 


Editorial Back to top

My phone rang. Gibi was on the other side of the line.

“Where have you been?” he asked.

“At the IOD conference. Why didn’t you come?” I asked.

“Could not afford it,” replied Gibi. “I will try to make it to the IIUG conference”.

“Good,” I said. “So what are you up to this time?”

“I am starting a newsletter. The Outsider.”

“Great idea. The more the merrier. And where will you publish it?”

“You will do it for me. You will publish the Outsider in the Insider.”

“Isn’t it a little confusing?” I asked.

“You confuse your readers anyway. That’s why I want to start with an interview so people can know what you really think.”

So here it goes.

The IIUG Outsider (Issue #1)

An interview with Gary Ben-Israel, the IIUG Insider Editor.

Q: How do you feel about Informix?
A: Much better.
Q: What has changed?
A: Well first there is the new 11.7 release.
Q: So what?
A: It’s a great release loaded with new features.
Q: Informix was always the best database. So what has changed?
A: This time there are features the competition can’t claim, with a clear conscience, that they have. They are not even close.
Q: Sure they can. Truth is not something they use very often. And their conscience is always clear, they never use it. Do you think it will change?
A: The difference is too obvious. The press will call their bluff.
Q: The press? Isn’t Informix IBM’s best kept secret?
A: Not anymore. Just read the Informix News section in the October Insider and you will see for yourself.
Q: With all due respect, Marketing is not enough. You need to actually sell the product. What about sales?
A: This is taken care of as well. There is a new world wide Swat Team that is dedicated to selling Informix to new customers.
Q: Do you believe it will make a difference?
A: I hope it will. We shall at least give it a chance.
Q: So everything is good?
A: No. We still have a long way to go. There are many Informix users that gave up and left. Some of them good friends that have been loyal to Informix for years.
Q: What is IBM doing about it?
A: What are you doing about it?
Q: Why do Jews always have to answer a question with another question?
A: Why not?
Q: OK. I will rephrase my question. What do you think needs to be done about it?
A: First, all Informix users need to ask ourselves and our near friends to try and hold on. Convince our management that even if they are determined to leave Informix to wait for a while before taking a step they may regret. Second, the IIUG board needs to make IBM management aware of the severity of the problem. We did it already and will keep doing it. I believe they will make it a priority. This is as far as the Informix user community can go. From this point IBM needs to stop the bleeding, as a medic I know this is the first step in treating a trauma patient, and get Informix the market share it deserves.
Q: That looks too good to be true.
A: I have always been an incorrigible optimist. This time I feel my optimism has a solid foundation. Let’s all try and keep our spirit. It is not easy but it’s worth the effort.

Gibi
The IIUG Outsider Editor

Many people asked me if Gibi is a real person. Well of course he is. Many of you know him. Gibi is not his real name but other than that he is a long time loyal Informix user.

Gary Ben-Israel
IIUG Insider Editor


Highlights Back to top

IBM releases Informix Dynamic Server 11.70

IBM Informix 11.70 delivers grid and enhanced embed capabilities for industry-leading flexibility, reliability, speed, and efficiency.

At a glance Informix 11.70 offers:

  • Linear scale out beyond a single cluster and better hardware utilization using Informix Flexible Grid
  • Enhanced deep embed autonomics for improved time-to-value, reduced costs and higher reliability which can be particularly helpful in Software As a Service (SaaS) environments
  • Enhanced warehouse management infrastructure for increased manageability and performance
  • Enhanced programmability and support for service-oriented architecture (SOA)
  • Enhanced security capabilities, management and administration for improved time and effort to compliance and data protection
  • Improved developer productivity and data management with IBM(r) Optim(tm) Development Studio
  • Rapid development of Informix related dynamic Web 2.0 applications and mashups

Like the previous releases Informix 11.7 is loaded with features increasing performance, security, embedability, ease of use etc… Once again Informix DBAs and developers are ecstatic about the new release. But there are two features that go beyond the technical level. The Flexible Grid along with the Seamless, transactional continuity during failover offer unique capabilities:

  • Mixing hardware, operating systems and Informix versions
  • Spreading them across geographies
  • Easily managing the grid from a single location
  • Transactions can continue to run on an established Informix secondary server when a primary server fails

Making Informix 11.7 a CIO’s dream come true

Learn more about Informix 11.7 at: /url/informix_11.7_announcement.html


Conference corner Back to top

2011 IIUG Conference Registration is now open!

Registration for the 2011 International Informix User Group Conference is now open. Join us in Overland Park, Kansas, May 15 – 18, 2011 for the largest gathering of Informix professionals. This year’s conference promises to be the best conference to date. The conference will contain the most Informix content at the most reasonable cost.

Conference registration includes three full days of Informix topics including over 80 technical user sessions and several hands-on labs presented by top IBM and Informix user professionals. The conference kicks-off Sunday evening with the welcome reception and concludes after Wednesday’s full day of sessions. You will also have access to all conference networking events and quality Informix product vendors. Consider starting the conference early by signing up for one or more tutorials to be offered on Sunday, May 15th, for a nominal fee.

Take advantage of early bird pricing and register by January 31, 2011 to save $125 off the regular conference price. IIUG members who register online prior to May 1, 2011 are eligible for an additional $100 savings. If you are not currently a member and want to take advantage of this savings sign up today at: /iiug/join.html.

Visit /conf/2011/iiug/register.php for additional registration prices and details.

Speaker Deadline Submission Extended

The deadline to submit speaker proposals has been extended from November 1 to November 15, 2010. If you are still contemplating speaking at the conference, we require a brief description of your presentation and biography by November 15th. Conference speakers are provided with a complimentary pass providing access to conference sessions, meals and conference related networking events. For more information and to register your proposal, go to /conf/speakers.

IIUG Conference “Friends”

Sign up as a friend of the 2011 IIUG Conference and receive timely updates related to the conference and pertinent information concerning Informix and Informix products. Visit our Facebook account at /url/conf_facebook.html and become a friend today.

See you at the conference.

The IIUG Planning Committee

/conf

IBM Information On Demand Global Conference 2010 – Recap

The Information On Demand 2010 topped all its predecessors. More attendees (over 10,000), more topics, more sessions, actually more of everything. The “smart site” an online website enabled the conference attendees to be updated in real time, fill evaluation forms and participate in poles.

Three new software releases Cognos 10, DB2 10 for Z OS, and Informix 11.7 (11.7 steps ahead of them). Naturally I will focus on the Informix part. I did not attend other sessions so I have no choice.

If you missed the 37 Informix Sessions and hands-on labs your only chance to get up to date is to register for the IIUG Informix conference 2011. If you did not, I am sure that, like me, you gathered valuable information on the new features in 11.70 and more. If this is the case you are, like me, an Informix fan and will not miss the IIUG Informix conference 2011.

New Features in 11.70: http://www.ibm.com/software/data/informix/
IIUG Conference 2011: /conf


Education Back to top

Advanced Data Tools

How to become the FASTEST Informix DBA!

November 15-18, 2010 – Advanced Informix Performance Tuning Course

This course is for database administrators and application developers who will be responsible for managing, optimizing, and tuning an IDS database server. The focus is on skills, procedures, and scripts to improve the performance of your database server. The course will provide a toolkit of scripts and utilities to start monitoring and optimizing your IDS database server. (Cost $2,000 USD)

Class times are 9am to 5pm; dress is casual. See http://www.advancedatatools.com/OurCompany/DirectionsMapsHotels.pdf for directions and hotels near Advanced DataTools’ Office.

For information and to register visit http://www.advancedatatools.com/Training/InformixTraining.html or call 703-256-0267 x101.

Informix Tech Day Tuesday, November 9, 2010

Now that Informix 11.70 (Panther) has been released we can share with you some more details about our Washington Area Informix User Group Tech Day.

This will be a deep technical dive into what is in the new release by John Miller III, STSM, Embedability Architect from IBM. Art Kagel and Lester Knutsen will also share with you the results of our hands-on tests with the beta and pre-release of Informix 11.70 and performance improvements.

Washington Area Informix User Group – Informix Tech Day – A FREE event for Informix Users

Date: Tuesday, November 9, 2010 9:00am to 5:00pm
Location: Crowne Plaza National Airport 1480 Crystal Drive Arlington, VA 22202 (near the Crystal City Metro)

Agenda:

  • Breakfast
  • Session – The New Features in Informix
  • Lunch
  • Session – More New Features in Informix

Please join us for this event. This event is FREE.

Registration is required. Register at /waiug/.

IBM

Support

Get Empowered with IBM Software Subscription and Support

Software Subscription and Support keeps your mission critical software up to date – making your organization smarter, greener and more cost effective. Active Subscription and Support extends that value of your software with enhancements and new releases available to you without additional upgrade purchases. This increases your ROI, simplifies budgeting and gives you the flexibility to plan the upgrades to your systems. Stay current on your IM Subscription and Support and watch this short video to learn more about how Subscription & Support delivers real value for your business success.

Books

Go green and purchase eBooks

Lately, everyone is talking about eBooks and eReading devices. IBM is at the leading edge of this movement toward green books for our products and technologies.

  • IBM Redbooks Publications: for more than 40 years, IBM has been creating “how to” books to help you build your skills on our products and technolgies. There are half a million IBM Redbooks downloaded every year! IBM Redbooks are available to you for FREE in PDF format. Read these books on your computer, laptop or any device that will accept PDF documents.
  • IBM Press: IBM Press has published a wide variety of books that can be purchased in the traditional book format, Kindle format, PDF format, or through online book engines such as Safari Books Online and Books 24×7

Visit IBM Redbooks! (http://www.redbooks.ibm.com/)

Visit IBM Press (http://www.ibmpressbooks.com)

Certification

New Information Management Professional Certification

  • Informix 11.50 Application Developer (Exam 556)

Education

Drive your 2011 success, Request a complimentary Information Management Training Plan!

One of the most important factors in determining an IT project’s success is the team’s skill level. As you plan and budget for 2011, make sure your team has the skills to drive your projects’ success.

IBM Training Plans help you budget accurately

To build an accurate budget, consider: Which team members need training? What kind of training? How soon? Once your needs are determined, IBM offers complimentary training plans to match.

Get started and request your complimentary training plan. Simply complete the online request form and Information Management Training experts will work with you to develop a custom training plan for your entire team that addresses:

  • Training recommendations based on business roles, products and project timelines
  • Scheduling recommendations mapped to your project timelines
  • Cost-saving strategies to stretch your training budget

Learn more!
http://www.ibm.com/software/data/education/plans.html?ca=octnls

Grow your Information Management skills for less with new discounts on the IBM Education Pack

Reach your skill-building goals and save money,too! For a limited time, IBM is offering new discounts on the IBM Education Pack-online account. When you invest at least $25,000 in the IBM Education Pack – online account, you will save 15%! Train your entire team for less! This special promotional discount expires January 23, 2011.

Learn more!
http://www.ibm.com/training/us/savings/edpack

IBM Training Netbook Offer -Time is running out!

Get a Lenovo netbook when you enroll in an eligible class by October 29 and complete the class by December 17, 2010, it’s that simple!

Don’t wait, only days left!
http://www.ibm.com/training/us/swgnetbook5

Custom Private Onsite Data Management Courses

Did you know that we can customize private onsite Information Management courses by mixing and matching modules from existing courses as necessary to meet your client’s specific training requirements.

Learn more by sending an email to:
dmedplan@us.ibm.com

Get peace of mind when you register for an Information Management Guaranteed to Run (GTR) Class

Enroll in one of our GTR classes and rest assured that the class will be held. When you make your training plans, you want to know that the time you’re taking and the effort you’re making won’t go to waste. Be confident that your class will run – no matter what. See if the training you want is Guaranteed to Run, there are more than 30 Information Management courses currently available!

/url/info_management.html


Developer corner Back to top

New in DeveloperWorks

IBM Informix Developer’s Handbook
http://www.redbooks.ibm.com/abstracts/sg247884.html?Open
This IBM Redbooks publication provides fundamentals of Informix application development. It covers the Informix Client installation and configuration for application development environments. It discusses the skills and techniques for building Informix applications with Java, ESQL/C, OLE DB, .NET, PHP, Ruby on Rails, DataBlade, and Hibernate. The book uses code examples to demonstrate how to develop an Informix application with various drivers, APIs, and interfaces. It also provides application development troubleshooting and considerations for performance.

29 Oct 2010

Compare the Informix Version 11 editions
http://www.ibm.com/developerworks/data/library/techarticle/dm-0801doe/index.html
Get an introduction to the various editions of IBM Informix, and compare features, benefits, and licensing considerations in a side-by-side table. Regardless of which edition you choose, Informix brings you legendary ease-of-use, reliability, stability, and access to extensibility features.

25 Oct 2010

Informix DBA: Building Fast Data Warehouse Schemas: Part 3
http://www.ibm.com/developerworks/data/library/dmmag/DMMag_2010_Issue4/InformixDBA/index.html
The last of Lester Knutsen’s three-part series focuses on designing summary tables.

10 Oct 2010

NewsBytes: Issue 4, 2010
http://www.ibm.com/developerworks/data/library/dmmag/DMMag_2010_Issue4/NewsBytes/index.html

10 Oct 2010

For more information go to DeveloperWorks – Informix: /url/devworks.html


Informix corner Back to top

Informix on Campus

The Informix on Campus team has had a very busy year visiting places all around the world, and still 3 months remain in 2010! Here are our highlights:

USA

Kansas City, Missouri
University of Missouri – Kansas City: Both “Informix in a Box” sessions were full with approximately 50 students in attendance. A lab in which all the systems have Informix Virtual Appliance installed has been made available for student use. Students of one undergraduate and one graduate level course will have the opportunity to learn and use Informix. Two dedicated servers running Informix will also be made available for students, faculty, and staff for research and course work.
Mobile Data Management conference: The IBM Informix Academic Initiative program was one of the sponsors for this event and provided an opportunity to give a presentation to over a dozen faculty members from all over the world.
Milwaukee, Wisconsin
SIGCSE 2010 conference: ACM Special Interest Group on Computer Science Education (SIGCSE) brings together educators from around the world to develop, implement and/or evaluate computing programs, curricula and courses. IBM was a Gold supporter for this conference. Informix showed its presence by having a booth at the expo and networked with teachers from different universities and colleges.
Rochester, New York
Two “Informix in a Box” sessions were hosted at St. John Fisher College and Rochester Institute of Technology with over thirty students and faculty members in attendance. We hope to go again next year.

INTERNATIONAL

Colombia (Bogotá and Tunja)
Politécnico Grancolombiano: A 10-hour workshop introducing Informix was provided in June. In August, the school hosted an IBM day where the Informix room was inaugurated, with Informix installed and ready for the students to play around with it.
Juan de Castellanos: An Informix in a Box session was given with the attendance of 25 students and 3 professors. The hospitality was warming and students enjoyed learning and doing the exercises.
Pedagogic and Technological University of Colombia: 2-day “Informix in a Box” session was provided to 31 participants. UPTC will host the V National and I International Conference in Research in Computers and Information Technology in October. IBM has been invited to present our Informix Spatial technology to 300 participants.
France
EISTIC: Approximately 50 students attended the one-day “Informix in a Box” session at Ecole Internationale des Sciences du Traitement de l’Information (EISTIC). This school of Information Sciences has two campuses located in Cergy and Pau.
India (Bangalore and Tamilnadu)
RNSIT college: 1 day awareness session introducing Informix to students was completed, along with 3 days worth of session covering topics in depth. 28 students were also prepared and mentored to take the IDS 555 certification exam.
info CONNECT C 2010 conference: Around 250 students from 50 colleges attended this DB2/Informix Student User Conference. KLN College will conduct Informix training for all of its 240 students in Computer Science and Information Technology Department. The Informix Student User Group plan to conduct trainings at different colleges with the goal of getting 150 students certified.

For more details on those highlights, visit our blog at http://informixoncampus.blogspot.com.

We always would love to have your help! Please contact us at idsoncampus@us.ibm.com if you are interested in conducting an Informix in a Box session or have ideas.

Finally, we are excited to announce that the Informix 11.50 Application Developer Exam (556) is out! It is available at http://www.ibm.com/certify/tests/ovr556.shtml.

Vital links:

Website (coming): http://www.informixoncampus.org/
Blog: http://informixoncampus.blogspot.com/
Wiki: https://www.ibm.com/developerworks/wikis/display/IDS101/Home
Facebook Group: http://www.facebook.com/group.php?gid=59899462610


Informix news Back to top

IBM Helps Organizations Boost Business Performance With New Informix Database Software
MarketWatch – October 13

DHL, Rol Manufacturing, Oncor and M Systems International reduce costs, work more efficiently…

/url/oct2010_news1.html

IBM Acquires PSS Systems, Updates Informix
EContent – October 14

In related news, IBM unveiled the latest version of its Informix database software. The new version of IBM Informix is designed to help companies power business analytics along with transactional applications. To handle the growing volume of data, the new software also includes time series data management and data compression.

IBM is also introducing the new IBM Informix Flexible Grid, which gives clients the ability to scale data management across regional or global clusters while mixing different hardware and operating systems. The Informix Flexible Grid keeps data available to applications at all times, even during planned maintenance and upgrades, without the need for temporary hardware.

/url/oct2010_news2.html

Informix Database Updated For Performance
eWeek Eroupe – October 14

IBM has released Informix 11.7, an updated database with an emphasis on performance enhancements. It has also added Innovator-C Edition as a free download. “There are quite a few features that contributed to the performance – for warehouse improvement the primary ones were star/snowflake schema optimisations and multi-index scans,” noted Bernie Spang, director of database software and systems marketing…

/url/oct2010_news3.html

A New Appreciation for Database Performance
ITBusinessEdge – October 15

This is one of the reasons we suddenly see IBM promoting its Informix database. For the past 10 years, the Informix database has been the red-headed stepchild of DB2. But there are certain performance attributes of Informix that make it more suitable for processing significant amounts of data in real time…

/url/oct2010_news4html

IBM talks up data pedigree and time-stamped information – Taking advantage of data to reduce fraud and retain customers
V3.co.uk – October 28

Spang claimed that IBM’s TimeSeries tool, recently added to the latest release of Informix 7.11 database software, will help more businesses to benefit from this new type of data…

/url/oct2010_news5.html


Informix events Back to top

Informix 11.07 Workshops in Germany, Austria and Switzerland

Six one day workshops on Informix 11.70 across Germany, Austria and Switzerland in November!

Discover the new cat in town:

Informix 11.70, code named “Panther” comes to a location close to you in Germany, Austria and Switzerland. During the six free one day workshops you will get to know the new features in 11.70 like the Informix Flexible Grid, new and enhanced application development features like e.g. the integrated time series data type, powerful new embeddability features like automatic storage provisioning and memory management, significant data warehouse and OLTP performance enhancements plus much more.

The dates and locations for those workshops are:

November 9th, 2010 in Munich, Germany

November 10th, 2010 in Vienna, Austria

November 11th, 2010 in Duesseldorf, Germany

November 16th, 2010 in Zurich, Switzerland

November 17th, 2010 in Berlin, Germany

November 23rd, 2010 in Stuttgart-Ehningen, Germany

All workshops are being delivered in German language. For more details, the final agenda and registration please visit the following web site: http://www.ibm.com/de/events/informix/.


Support corner Back to top

Hibernate with Informix

Hibernate is an open source Java object-relational mapping (ORM) and persistence framework that allows you to map Plain Old Java Objects (POJO) to relational database tables. It provides a data query language independent to JDBC or SQL statements which helps to speed up the development of Java applications using different relational databases such as Informix or DB2.

Relational databases stored the information in a tabular way which differs to the normal representations of data in an object-orientated programming language as Java. Hibernate maps the database objects such as tables or rows, into Java objects like objects with attributes and methods.

As of version 3.6 Hibernate supports JPA 2.

What is JPA?

JPA stands for Java Persistence API – a standardized interface for Java Persistence that persistence providers implement. Hibernate is one such JPA provider.

JPA 2 includes (influenced by Hibernate) General/Unified configuration parameters.

Example:

javax.persistence.jdbc.driver (Hibernate specific equivalent is: hibernate.connection.driver_class)

javax.persistence.jdbc.user (Hibernate specific equivalent is: hibernate.connection.username)

javax.persistence.jdbc.password (Hibernate specific equivalent is: hibernate.connection.password)

javax.persistence.jdbc.url (Hibernate specific equivalent is: hibernate.connection.url)

Note: Hibernate Core 3.6 requires JDK 1.5 or higher (3.5 requires JDK 1.4 or higher)

To be able to use Hibernate with an Informix database, first you need to download the Hibernate API, you can get the latest Hibernate API from:

http://sourceforge.net/projects/hibernate/files/hibernate3/

Just download hibernate-distribution-3.6.0.Final-dist.zip and everything is in it. Fun isn’t it? ?

From the Hibernate package you need the following jars:

hibernate3.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
antlr-2.7.6.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
javassist-3.9.0.GA.jar
jta-1.1.jar
slf4j-api-1.5.8.jar

In addition to the Hibernate classes, you’ll need the Informix JDBC (included with the Informix database server) and one of the implementation of the SLF4J (Simple Logging Facade for Java) which you can get from http://www.slf4j.org/download.html. (If you are using a build manager like Apache Maven you can define all your dependencies and there is no need to remember the different jars. A good thing done by hibernate was consolidating al the main components into one jar so there is no longer a need for what was known as compatibility matrix.)

From the Informix JDBC driver, we need the following class:

ifxjdbc.jar

and from the SLF4J package:

SLF4J-api-1.5.8.jar
slf4j-nop-1.6.1.jar

First step is to include all these jars into your classpath:


  ---- setenv.ksh ----
  export CLASSPATH=$CLASSPATH:.
  export CLASSPATH=$CLASSPATH:./lib/commons-collections-3.1.jar
  export CLASSPATH=$CLASSPATH:./lib/dom4j-1.6.1.jar
  export CLASSPATH=$CLASSPATH:./lib/hibernate-jpa-2.0-api-1.0.0.Final.jar
  export CLASSPATH=$CLASSPATH:./lib/hibernate3.jar
  export CLASSPATH=$CLASSPATH:./lib/javassist-3.9.0.GA.jar
  export CLASSPATH=$CLASSPATH:./lib/jta-1.1.jar
  export CLASSPATH=$CLASSPATH:./lib/slf4j-api-1.6.1.jar
  export CLASSPATH=$CLASSPATH:./lib/antlr-2.7.6.jar
  export CLASSPATH=$CLASSPATH:./lib/slf4j-nop-1.6.1.jar
  export CLASSPATH=$CLASSPATH:./lib/ifxjdbc.jar
  ---- setenv.ksh ----

A basic Hibernate application needs the following files:

  1. A configuration file for the Hibernate framework.
  2. Some XML Mapping files for the Java objects.
  3. A ‘HibernateUtil helper’ class that provides access to the Hibernate session from the Java application. In the current JPA version ‘HibernateUtil is replaced by EntityManager although it is still recommended to use ‘HibernateUtil for demos and small applications.
  4. The Java files where the Java objects are defined.
  5. The Java application that will use the Java persistence objects.

The Hibernate configuration files are ‘hibernate.properties’ or ‘hibernate.cfg.xml’. These files contains information that Hibernate needs to connect to the database server. Details such as name of the JDBC driver class, ConnectionString, and authentication details are stored here.

A ‘hibernate.cfg.xml’ using the informix JDBC driver looks like:


----- hibernate.cfg.xml -----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="Informix_Session">
<!-- properties -->
<property name="connection.driver_class">
  com.informix.jdbc.IfxDriver
</property>
<property name="connection.url">
  jdbc:informix-sqli://dubito:9089/stores7:INFORMIXSERVER=dubi1150;
</property>
<property name="hibernate.connection.username">
  informix
</property>
<property name="hibernate.connection.password">
  password
</property>
<property name="dialect">
  org.hibernate.dialect.InformixDialect
<!-- The dialect shipped with Hibernate is missing functionality
You can download an extender version from the IIUG software repository -->

</property>
<property name="hibernate.show_sql">false</property>
<property name="hbm2ddl.auto">update</property>
Note: hbm2ddl.auto Drop and re-creates the database schema on startup. It is not recommended to use it.
It can discurd work done and above that Hibernate is not optimal for create indexes.

<!-- mapping files -->
<mapping resource="State.hbm.xml"/>
</session-factory>
</hibernate-configuration>
----- hibernate.cfg.xml -----

A configuration parameter worth mentioning is:


<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>

It is valuable for debugging your application.

Parameters like ‘connection.driver_class’ and ‘dialect’ are used to specify the JDBC driver to use and the dialect to use. A Hibernate dialect is a Java class that contains specific details regarding the SQL syntax that is needed to communicate with a particular database.

Next step is to create a file with the information to map the objects in the database. The mapping file tells Hibernate what table in the database it has to access, and what columns in that table it should use. It also provides support features, such as creating the database schema and relationship between the objects.


---- State.hbm.xml ----
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
 <class
    name="State"
    table="States">
    <id
       name="id"
       column="id">
       <generator class="increment"/>
    </id>

    <property
       name="code"
       column="code"/>
    <property
       name="sname"
       column="sname"/>

 </class>
</hibernate-mapping>
---- State.hbm.xml ----

These details are used by the Hibernate libraries to generate SQL statements automatically, including Data Definition Language (DDL) and Data Manipulation Language (DML).

The HibernateUtil class is used to interact with the Hibernate service. It performs the operations related to the Hibernate SessionFactory classes that provide a convenient way for the application to access the Hibernate session.

This is how a helper class looks like:

  ---- HibernateUtil.java ----
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;

  public class HibernateUtil {
   private static final SessionFactory sessionFactory;

   static {
     try {   // Create the SessionFactory from hibernate.cfg.xml
       sessionFactory = new Configuration().configure().buildSessionFactory();
    }
    catch (Throwable ex) {
       System.err.println("Initial SessionFactory creation failed." + ex);
       throw new ExceptionInInitializerError(ex);
    }
   }

   public static SessionFactory getSessionFactory() {
      return sessionFactory;
   }

   public static void shutdown() {
      getSessionFactory().close();   // Close caches and connection pools
   }
  }
  ---- HibernateUtil.java ----

Persistence Java objects can be defined using Plain Old Java Objects (POJO) syntax. These objects will represent the database objects inside the Java application.

The following code shows the definition for the ‘State’ object:


 ---- State.java ----
 public class State {
    private Long id;
    private String code;
    private String sname;

    public State() {}
    public State(String text, String text2) {
      this.code = text;
      this.sname = text2;
    }
    public Long getId() {
       return id;
    }
    private void setId(Long id) {
       this.id = id;
    }
    public String getCode() {
       return code;
    }
    public void setCode(String text) {
       this.code = text;
    }
    public String getSname() {
       return sname;
    }
    public void setSname(String text) {
       this.sname = text;
    }
 }
 ---- State.java ----

An example using annotations (With some extra attributes)


@Entity
@Table(name="states")
public class State {

	@Id
    private Long id;

	@Column(name="code", length="10", nullable=false)
    private String code;

	@Column(name="s_name", length="10", nullable=false)
    private String sname;

    public State() {}
    public State(String text, String text2) {
      this.code = text;
      this.sname = text2;
    }
    public Long getId() {
       return id;
    }
    private void setId(Long id) {
       this.id = id;
    }
    public String getCode() {
       return code;
    }
    public void setCode(String text) {
       this.code = text;
    }
    public String getSname() {
       return sname;
    }
    public void setSname(String text) {
       this.sname = text;
    }
 }

// Recommended to add your own implementation for:
// equals , hashCode
// It is a good practice, however most developer simply forget about it...

The object has three properties (id, code, and sname) and the usual methods to set and get those properties, such as ‘setCode()’ or ‘setSname()’. The ‘id’ attribute is used to uniquely identify the Java persistence object.

Entities must follow the JavaBean conventions – i.e. getter and setters, equals/hashcode, must be serializable and must have a public or protected no-arg constructor.

The Hibernate API can generate the DDL to create the database table automatically using the Java object properties.

The last step is to create a Java application to use our Hibernate persistence Object. The Java object is used in the same way as any other object, the only difference is that we can make it ‘persist’ (saved it into the database) using the Hibernate session helper class.

This example shows how to create an instance of the ‘State’ object we defined before:


  ---- create.java ----
  import java.util.*;
  import org.hibernate.*;
  import javax.persistence.*;

  public class create {
   public static void main(String[] args) {

   Session Session = HibernateUtil.getSessionFactory().openSession();
   Transaction Transaction = Session.beginTransaction();

   State myState = new State();
   myState.setcode(args[0]);
   myState.setsname(args[1]);
   Long stateId = (Long) Session.save(myState);

   System.out.println("Stated added: "+myState.getcode()+", "+myState.getsname() );

   Transaction.commit();
   Session.close();

   HibernateUtil.shutdown();
   }
  }
  ---- create.java ----

The method ‘Session.save()’ is used to save the Java object ‘myState’.

After compiling and running the code, you can check what has happend in the database:


  D:\Infx\work\state>dir /b
  create.java
  delete.java
  hibernate.cfg.xml
  HibernateUtil.java
  list.java
  State.hbm.xml
  State.java
  update.java

  D:\Infx\work\state>javac HibernateUtil.java

  D:\Infx\work\state>javac State.java

  D:\Infx\work\state>javac create.java

  D:\Infx\work\hello\state>java create CA CALIFORNIA
  Stated added: CA, CALIFORNIA

  D:\Infx\work\state>

The ‘States’ table has been created in the database which contains the Java object ‘myState’:


  > select * from states;

  Id	1
  Code	CA
  Sname	CALIFORNIA

  1 row(s) retrieved.

  > info columns for states;

  Column name	Type	Nulls

  Id	int8	no
  Code	varchar(255)	yes
  Sname	varchar(255)	yes
  >

You can update the information in the table using the Java object methods like setsname() or setcode()

This code shows how to update the ‘sname’ column through the java object:


  ---- update.java ----
  import java.util.*;
  import org.hibernate.*;
  import javax.persistence.*;
  import org.hibernate.criterion.*;

  public class update {
   public static void main(String[] args) {

     Session Session = HibernateUtil.getSessionFactory().openSession();
     Transaction Transaction = Session.beginTransaction();

     Criteria crit = Session.createCriteria(State.class);
     crit.add( Restrictions.eq( "code", args[0]) );
     List states = crit.list();

     for ( Iterator iter = states.iterator(); iter.hasNext(); ) {
      State state = (State) iter.next();
      System.out.println("Previous name:\t"+state.getsname() );
      state.setsname(args[1]);
      Session.flush();
      Long msgId = (Long) Session.save(state);
      System.out.println("New name:\t"+state.getsname() );
     }

     Transaction.commit();
     Session.close();

     HibernateUtil.shutdown();
    }
  }
  ---- update.java ----

  D:\Infx\work\state>javac update.java

  D:\Infx\work\state>java update CA California
  Previous name:  CALIFORNIA
  New name:       California

  D:\Infx\work\state>

One of the main features of using Hibernate is that it abstracts the JDBC layer from the application. Thus, applications written using the Hibernate API are not tied to a specific JDBC driver or relational database server.

You can find more information about how to use Hibernate with Informix, in a recently published IBM redbook ‘IBM Informix Developer’s Handbook’ (SG24-7884-00):

http://www.redbooks.ibm.com/abstracts/sg247884.html?Open

You may also look at Envers which is now part of Hibernate:

http://www.jboss.org/envers

Javier Sagrera
Common Client Technologies (CCT) Advanced Support


Informix resources Back to top

Informix Blogs and things

  • The IIUG forums at /forums/technical.php **** these are very good****
  • Andrew Ford’s blog http://www.informix-dba.blogspot.com/ **** New *****
  • Blogs, Videos, News and more at http://planetids.com
  • IDS Experts at http://www.ibm.com/developerworks/blogs/page/idsteam
  • Mark Jamison at http://www.ibm.com/developerworks/blogs/page/gbowerman
  • Madison Pruet at http://www.ibm.com/developerworks/blogs/page/roundrep
  • Jacques Roy at http://www.ibm.com/developerworks/blogs/page/jacquesroy
  • Cathy Elliott at https://www.ibm.com/developerworks/mydeveloperworks/blogs/InformixVoices
  • Informix blogs at http://www.ibmdatabasemag.com/blog/main/archives/informix/index.html
  • Kate Dawson at http://www.ibm.com/developerworks/blogs/page/katedawson
  • Fernando Nunes at http://informix-technology.blogspot.com/
  • Virtual Worlds, MMOGs, Serious data – Informix Technology for Persistent Worlds http://informix4virtual.wordpress.com/
  • IBM DATABASE MAGAZINE at http://www.ibmdatabasemag.com
  • The Informix Zone at http://www.informix-zone.com
  • The Informix mag at http://www.informixmag.com/
  • IIUG Developers Desktop /devnews/Vol_1_Iss_4/Home.html
  • Informix Newsletter in Germany http://www.informix-zone.com/informix-german-newsletter
  • Informix Newsletter in France http://www.informix-zone.com/informix-french-newsletter
  • There is an Informix group on LinkedIn. The group is called “Informix Supporter”, so anyone loving Informix can join, from current IBM employees, former Informix employees, to users. It will also be a good occasion to get in touch with others or long-time-no-seen friends. If you fancy showing the Informix logo on your profile, join. To join, simply go to http://www.linkedin.com/e/gis/25049/5E4B2048E558.

Calendar of events Back to top

November – 2010
Date Event Location Contact
9 Washington Area Informix User Group Tech Day Crowne Plaza National Airport, Arlington, VA Lester Knutsen
9 Informix 11.7 – Panther Workshop Munich, Germany Alexander Koerner
9-11 2010 IDS 11.5 Bootcamp Casablanca, Morroco
10 Informix 11.7 – Panther Workshop Vienna, Austria Alexander Koerner
11 Informix 11.7 – Panther Workshop Dusseldorf, Germany Alexander Koerner
11 UK Informix Community Event Warwickshire, United Kingdom
11-12 2010 Informix Roadshow Johannesburg, South Africa
15-16 2010 Informix Roadshow Zagreb, Croatia Hrvoje Zokovic
16 Informix 11.7 – Panther Workshop Zurich, Switzerland Alexander Koerner
17 Adriatic Informix User Group Meeting Zagreb, Croatia Hrvoje Zokovic
17 Informix 11.7 – Panther Workshop Berlin, Germany Alexander Koerner
18-19 2010 Informix Roadshow Zagreb, Croatia Hrvoje Zokovic
23 Informix 11.7 – Panther Workshop Stuttgart-Ehningen, Germnay Alexander Koerner
23-25 2010 IDS 11.5 Bootcamp Kuala Lumpur, Malaysia
30 Informix User Group of France IBM, Bois-Colombe Khaled Bentebal
December – 2010
Date Event Location Contact
9 Chicago Informix User Group Meeting Chicago, Illinois Rob Beal
May – 2011
Date Event Location Contact
15-18 2011 IIUG Informix Conference Overland Park, Kansas Cindy Lichtenauer

Useful links Back to top

/quicklinks.html


Closing and credits Back to top

The International Informix Users Group (IIUG) is an organization designed to enhance communications between its worldwide user community and IBM. The IIUG’s membership database now exceeds 25,000 entries and enjoys the support and commitment of IBM’s Data Management division. Key programs include local user groups and special interest groups, which we promote and assist from launch through growth.

Sources: IIUG Board of Directors
IBM Corp.
Editors: Gary Ben-Israel

For comments, please send an email to gary@iiug.org.

Published
Categorized as Insider

By Vicente Salvador

Board member since 2014, a user since 1989 and Informix fan. I'am software architect which allow me to combine technical and business skills.