Search

I'll be at


My Twitter

    Subscribe

    Recent entries

    No recent entries.

    Archives by subject

    Archives by date

    Sun Mon Tue Wed Thu Fri Sat
        1 2 3 4 5
    6 7 8 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26
    27 28 29 30 31    
    20
    Mar

    Dumping MySQL databases using Groovy

    Today I needed to use Groovy to create a dump of all MySQL databases on the MySQL server running on my local machine.

    So I looked at my earlier blog entry on how to dump MySQL databases using the "mysqldump" command.

    So when I issued the command create a dump from console, the contents of the database are dumped to a sql file as expected.

    // Works in command line
    mysqldump --all-databases -u [username] -p[password] -C > alldatabases.sql

    As you might know, it is fairly straight-forward to execute shell commands from Groovy. You simply put the command in quotes and call the execute() method.

    However, when I issued the same command using Groovy, the command did not work... well, at least not at first.

    » Continue reading "Dumping MySQL databases using Groovy"

    27
    Feb

    Backing up and restoring all MySQL databases

    This is another one of those "lest I forget" type of blog entries. There are times one has to migrate all MySQL databases to another box (like now when I have to give my Mac for repair and I have to work in a Windows machine!) This is the command to backup all MySQL databases

    mysqldump --all-databases -u [username] -p -C > alldatabases.sql

    Replace [username] with the name of the MySQL user. I used "root" as it has access to all databases. This will create a file called "alldatabases.sql" containing all the SQL commands for creating the databases and inserting data into them. To restore from this SQL file, use this command

    mysql -h localhost -u [username] -p < alldatabases.sql

    Now, I won't have to rummage through the big wild web for this!

    2
    Aug

    Using SQuirrel SQL Client to connect to Apache Derby Database

    Of late I've had to use Apache Derby in my work. SQuirrel SQL is a great, Java-based client for connecting to any JDBC compliant database.

    I recently did a couple of screencasts (at my place of work) on installing and setting up SQuirrel SQL to work with Derby.

    Here are the links to the screencasts:

    Installing SQuirrel SQL Client for Apache Derby

    Set up SQuirrel SQL for Apache Derby Database

    6
    Mar

    Using JDBC to connect to Microsoft Access database

    I'm doing a training tomorrow for which I needed to use a demo Microsoft Access database.

    However, my laptop does not have ColdFusionMX 7 ODBC Server and ODBC Agent installed as Windows services. So, each time I try to setup a Microsoft Access datasource, I get a message:

    The ColdFusion MX 7 ODBC Server service is not running or has not been installed. You may also use the "MS Access with Unicode" driver to connect to MS Access datasources.

    As I didn't feel like manually installing the ODBC agent and server, I wondered if there was a way to simply use JDBC to connect directly to the Access database.

    And there is.

    » Continue reading "Using JDBC to connect to Microsoft Access database"

    5
    Feb

    Running MySQL 5 as MySQL 4

    I use MySQL 5 as the default database for the work that I usually do.

    Today I came across a situation where I needed to test some MySQL 4 functionality.

    An option was to install MySQL 4 on another port (not the standard 3306).

    However, an easier option is to simply switch the MySQL mode.

    /* show the current sql mode */
    SELECT @@GLOBAL.sql_mode;

    /* change the settings to mysql 4 mode */
    /* the 'GLOBAL' keyword changes the mode for all clients that connect from that time on */

    SET GLOBAL sql_mode = 'NO_FIELD_OPTIONS,HIGH_NOT_PRECEDENCE';
    More information can be found at: http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html

    19
    Sep

    Installing Apache Derby Database on ColdFusionMX 7.0.2

    I recently re-discovered Apache Derby, a Java-based database that seems like a promising alternative to MySQL. I downloaded it a few months back but for some reason or the other never persisted with it. Anyway, this time around there were other factors so I went through the motions of understanding how it works and setting it up.

    » Continue reading "Installing Apache Derby Database on ColdFusionMX 7.0.2"