wiki:ChangingTheDatabase

Version 8 (modified by Gavin, 14 years ago) (diff)

--

Changing the Database

Back to Installing

To change the database used by gnuMims a custom WAR must be built from the source code.

  • Perform an anonymous checkout.
  • Change grails-app/conf/DataSource.groovy file to suite.
  • Test or build your custom war with "grails run-app" or "grails war" commands.

Most common databases are supported by Grails (via Hibernate), we test and run MySQL (InnoDB).
The database must support transactions and row locking.
A jar matching the configuration needs to be placed in the projects lib dir (e.g. lib/mysql-connector-java-5.1.7-bin.jar Connector)
See the headings bellow for more details on each database tested so far.

For more info see the DeveloperStartPage and Grails documentation.

MySQL

MySQL is the database we use most often and therefore the most thoroughly test and highly recommended.
Also see Installation Tips and Mysql Confg

PostgreSQL

Not tested, please email us if you have tested against PostgreSQL.
We will run some tests against PostgreSQL when time permits or if requests are made.

MSSQL

Live deployment in progress (11-Jan-2010) no issues so far.

Oracle DB

Currently gnuMims will not run against an Oracle DB without some work.
The known issues should be surmountable and are listed bellow:

  • 30 Char limit:
    • Several gnuMims domain classes and attributes exceed this limit .
    • This is possibly the biggest issue since Grails will create join tables for classes '!MyDomainClassName1' and '!MyDomainClassName2' as 'my_domain_class_name1_my_domain_class_name2'.
    • Table mappings may be of use here?
    • Abbreviated names would make building reports directly from the database much less intuitive.
  • The default sequence generator does not create Id's as expected, a suitable hibernate sequence generator needs to be set.
  • To store empty strings the IS_NULLABLE metadata for the column needs to be set.
  • Oracle reserved words ("comment" and "date") this can be solved with a mapping in the appropriate domain classes:
       static mapping = {
       columns {
           comment column:'entry_comment'
         }
       }