Grails

Handling corrupted references through ignoreNotFound database mapping in Grails

Hi,   Recently i had a use-case where we have the legacy database and it contains the corrupted references of a non existent record in many-to-one relationship, and i have to populate a grid that contain info also from referenced record. As referenced record doesn't exist, So when we refer to the certain record will result in...

by Tarun Pareek
Tag: Database
17-Apr-2012

Technology

Clear Time function for MySQL

Hi all, Here is a simple function that can allow you to clear time from the DATETIME field of your database table [sql] DROP FUNCTION IF EXISTS cleartime; delimiter // CREATE FUNCTION cleartime(dt datetime) RETURNS DATETIME NO SQL DETERMINISTIC BEGIN DECLARE t varchar(15); -- the time part of the dt ...

by Gaurav Sharma
Tag: Database
12-Apr-2012

Technology

mysqldump of particular records without create – drop of tables

Hi,   Recently i was in a situation where i need to take the dump of particular records in mysql. We are pretty much familiar with the normal mysqldump statement given below : [sql] mysqldump --user=usr --password=pwd database_name table_name > dumpFile.sql; [/sql] The above statement will provide us the dump of the...

by Tarun Pareek
Tag: Database
27-Mar-2012

Grails

Dbconsole in Grails.

So, Grails 2.0 was released a few days back and I upgraded my application to it as soon as I came to know of its final release and it rocks.!! Among the many things which are making a lot of noise on grails 2.0, there seems to be a lack of noise over the GUI Database console which grails has provided. Developers can connect to the...

by Sachin
Tag: Database
25-Dec-2011

Grails

Truncate Table ? executeUpdate OR createSQLQuery

In one of the modules that I was working on , I needed to delete the previous data from a table then load up the data into those tables again and then manipulate code through the 'id's' on those tables. So this is what I was doing ... [groovy] Event.executeUpdate('delete from Event') EventInstance.executeUpdate('delete from...

by Manoj Mohan
Tag: Database
14-Apr-2011

Technology

Database Backup Script for windows

In one of the project I am working on, the application needs to be deployed on windows server. To take the database backup, I wrote the script which does the following : Takes database dump and copy it to the backup folder. Zip that backup file and rename it to the format "YYYYMMDD_HHMMSS" Removes  all the backups older than 30...

by Amit Jain
Tag: Database
14-Dec-2010

Grails

Grails Liquibase plugin: dbDiff tool workaround

The current project I am working on, is going through QA. At the same time development of the new features and bug fixing is on and we couldn't afford to loose the test data. So synchronizing the state of the QA database with the development was becoming a pain. So we decided to use grails liquibase plugin. I found one great article by...

by Amit Jain
Tag: Database
12-Oct-2010

Technology

Dumping a Mysql Database

In this post i will try to explain how to dump a mysql database so that it can be migrated with same state.In my project i face this situation every week and thanks to dumpfiles that they save lot of time and make the process whole lot easier. What is a dumpfile ? A dumpfile is a sql script which contains the step by step...

by gaurav
Tag: Database
16-Apr-2009