title: Connection with Grails to DB2 database
body: <p>I'm trying to connect my grails application to a DB2 database that is running locally. When I want to launch my app, I get multiples errors? I'm only getting started on grails and even more on DB2 database management. Can someone help me out ?</p>
  
  <p>Here's the error trails</p>
  
  <pre><code>    Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
     Line | Method
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 303 | innerRun in java.util.concurrent.FutureTask$Sync
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  Caused by SQLNestedException: Cannot create JDBC driver of class 'org.h2.Driver' for connect URL 'jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115'
  -&gt;&gt; 1452 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   1371 | createDataSource in     ''
  |   1044 | getConnection in     ''
  |   303 | innerRun in java.util.concurrent.FutureTask$Sync
  |   138 | run . .  in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run . .  in     ''
  ^   662 | run      in java.lang.Thread
  Caused by SQLException: No suitable driver
  -&gt;&gt; 264 | getDriver in java.sql.DriverManager
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
  |   1437 | createConnectionFactory in org.apache.commons.dbcp.BasicDataSource
  |   1371 | createDataSource in     ''
  |   1044 | getConnection in     ''
  |   303 | innerRun in java.util.concurrent.FutureTask$Sync
  |   138 | run      in java.util.concurrent.FutureTask
  |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run      in     ''
  ^   662 | run . .  in java.lang.Thread
  </code></pre>
  
  <p>and in my datasource.groovy file, here's what I changed :</p>
  
  <pre><code>environments {
      development {
          dataSource {
              dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
              //url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
              url = "jdbc:db2://localhost:50000/DTH3_E:currentSchema=DFP_V115"
          }
      }
  ....
  </code></pre>
  
  <p>With some research, I understood that it was my hibernate config. Can anyone (in)validate ? And where do I go next...pretty lost to say the least</p>
  
  <p>If wondering, the database is up and running and I'm able to connect to it using DbVisualizer.</p>
  
  <p>Thanks in advance for the help ! If more details are needed, ask :) I'll try to clarify as much as possible the problem.</p>