title: Cannot connect to Informix using Hibernate
body: <p>I'm trying to connect to Informix database using Hibernate 5.2.10, but the program doesn't respond and gets stuck without throwing any error message. </p>
  
  <p>I can't find anything from the console . Any suggest on what mistake I made? I'm new to Hibernate </p>
  
  <p>hibernate.cfg.xml</p>
  
  <pre><code>&lt;property name="connection.driver_class"&gt;com.informix.jdbc.IfxDriver&lt;/property&gt;
  &lt;property name="connection.url"&gt;jdbc:informixsqli://****:1528/****:informixserver=*****&lt;/property&gt;
  &lt;property name="connection.username"&gt;*****&lt;/property&gt;
  &lt;property name="connection.password"&gt;*****&lt;/property&gt;
  </code></pre>
  
  <p>Console:</p>
  
  <pre><code>Sep 17, 2017 11:05:55 AM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {5.2.10.Final}
  Sep 17, 2017 11:05:55 AM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  Sep 17, 2017 11:06:05 AM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  Sep 17, 2017 11:06:05 AM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
  INFO: HHH010002: C3P0 using driver: com.informix.jdbc.IfxDriver at URL: jdbc:informix-sqli://d7uat:1528/d7main:informixserver=uatserver
  Sep 17, 2017 11:06:05 AM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
  INFO: HHH10001001: Connection properties: {user=******, password=****}
  Sep 17, 2017 11:06:05 AM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
  INFO: HHH10001003: Autocommit mode: false
  SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  SLF4J: Defaulting to no-operation (NOP) logger implementation
  SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  Sep 17, 2017 11:06:07 AM org.hibernate.c3p0.internal.C3P0ConnectionProvider configure
  INFO: HHH10001007: JDBC isolation level: &lt;unknown&gt;
  Sep 17, 2017 11:06:08 AM org.hibernate.dialect.Dialect &lt;init&gt;
  INFO: HHH000400: Using dialect: org.hibernate.dialect.InformixDialect
  Sep 17, 2017 11:06:14 AM org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl getIsolatedConnection
  INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@7a0ef219] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode.
  </code></pre>
  
  <p>HibernateUtil</p>
  
  <pre><code>private static final SessionFactory sessionFactory = buildSessionFactory();
  
  public static SessionFactory getSessionFactory() {
      return sessionFactory;
  }
  
  private static SessionFactory buildSessionFactory(){
      final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure().build();
      try {
          return new 
       MetadataSources(registry).buildMetadata().buildSessionFactory();
      }
      catch (Throwable ex) {
          System.err.println("Initial SessionFactory creation failed." + ex);
          StandardServiceRegistryBuilder.destroy( registry );
          throw new ExceptionInInitializerError(ex);
      }
  }
  </code></pre>
  
  <p>InformixTest</p>
  
  <pre><code> public static CustomerInvoice lookupInvoice(String invoiceNumber){
      Session session = null;
      List&lt;CustomerInvoice&gt; customerInvoiceList = new ArrayList&lt;CustomerInvoice&gt;();
      CustomerInvoice customerInvoice = null;
      try {
          session = HibernateUtil.getSessionFactory().openSession();
          Query query = session.createQuery(invoiceByNumber);
          query.setParameter("invoiceNumber", invoiceNumber+"%");
          customerInvoiceList = ((org.hibernate.query.Query) query).list();
  
      } catch (Exception e) {
          e.printStackTrace();
          session.close();
      } finally {
          if (session != null &amp;&amp; session.isOpen()) {
              session.close();
          }
      }
  
  
      if(customerInvoiceList.size()&gt;0){
          customerInvoice = customerInvoiceList.get(0);
      }
  
      return customerInvoice;
  
  }
  </code></pre>