How to blogs and code snippets - Database Administration

Using JDBC with MySQL stored procedures

(Posted Thursday April 19, 2012 22:47:05)

Stored procedures are declarative SQL code which can be called by a trigger, another stored procedure or by an application code. In MySQL, they are compiled and stored in table proc of system database mysql. In this blog we will demonstrate how to create stored procedures and call it from a Java application through JDBC.




Creating a copy of an existing MySQL database, table structure, keys and records

(Posted Thursday October 20, 2011 21:31:50)

In this short blog we will demonstrate how to duplicate an entire MySQL database. We will also illustrate how to clone table structures, keys and records.




Create history record for every change in MySQL table - Audit trail; MySQL trigger

(Posted Tuesday August 30, 2011 00:48:23)

Here is a way of maintaining records of changes made to a table in your MySQL database using MySQL trigger.

Let us assume that we have a database called my_database, we also have a table called main_table, fields of this table are field1, field2, field3. We want history of changes made to this table into a table we call history_table. This has the same fields as main_table.