Node.js

NodeJs with MySql using Sequelize

This time I am going to explain a very basic CRUD operation on MySql database via NodeJs using Sequelize. Here Sequelize become's a bridge between NodeJs and MySql database, it is a Object Relational Mapping Library written on javascript. Let us quickly learn the things with the help of Examples and we will use Item Table to perform...

by Kashish Gupta
Tag: MySql
13-Oct-2014

AWS, Grails

Change MySQL Timezone on Amazon RDS

Amazon RDS doesn't allow you to change timezone, It keeps same UTC time zone across all regions. time_zone variable in the parameter group is read only.You can change the time zone on each connection or session by making a procedure in default mysql database and call this function on each init connection.1.    Create a procedure for...

by Tejprakash Sharma
Tag: MySql
31-May-2014

Grails

Show status of MySQL imports using PipeViewer

While working on my current application, I had to import a large database using mysql from a sql dump. The size of the sql dump was around 1.5 GB and hence the import was taking long time. I just felt the need of some tool that could help me check the progress of the import. The command I used was: [sql] mysql --user=username...

by Nikhil Bhandari
Tag: MySql
08-Apr-2014

Grails

Accessing remote data through cross-domain ajax call in jquery

While developing a mobile app using phonegap ( or otherwise also :) ), we can access remotely hosted mysql database using jquery ajax calls. But this interaction between jquery and mysql database cannot happen directly. We will need to specify a server side script (in PHP terminology) or a controller action (in Grails Terminology) that...

by raj
Tag: MySql
24-Sep-2012

Technology

Logging to remote MySQL Server using SSH tunneling

Very often, we all need to access a remote database for debugging or any other related stuff. The simplest thing that comes to mind is to take the dump of remote database and bring it to the local and run the application using that data. We can avoid that, if we can connect our local mysql client to a remote machine over a SSH...

by Sachin
Tag: MySql
17-Sep-2012

Technology

Toggling foreign key checks in MySQL

Recently in my project, we needed to import database dumps of a legacy database in MySQL, which was involved in a nested relationship where one tuple could be the parent record of another tuple. We created the appropriate domain structure and checked that the foreign key references were created accordingly. All well and good. So we...

by Roni C. Thomas
Tag: MySql
04-Sep-2012

Technology

Removing/replacing special character from database.

Recently in one of my project i faced a problem that database was having special character, which is shown as space on the User Interface. So as to solve this issue i found a very simple solution which consists of following steps: 1. First, you just need to identify which type special character to be removed/replaced like in my case...

by Anuj Aneja
Tag: MySql
11-Jun-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: MySql
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: MySql
27-Mar-2012

Grails

Alphanumeric Sorting using Criteria Query (with MySQL database)

I am working on a Grails application with MySQL database. I had a use case in which I had to implement alphanumeric sorting using Criteria Query on Grails. By alphanumeric sorting I mean if there is a class Employee with field empId then on doing : [plain] Employee e1 = new Employee(empId:'emp10').save() Employee e2 = new...

by Gaurav Sharma
Tag: MySql
02-Feb-2012

Grails

Mysql top just like we have top command in Linux

Once in my grails project i was facing the problem of freeze of server.When this happens tomcat becomes unresponsive.Later on by analyzing the thread dump we found that this problem might be due to the database and tomcat communication. So as to analyse how many connection are active at mysql end we found a query. Show processlist; ...

by Anuj Aneja
Tag: MySql
08-Oct-2011

Grails

A use case of Bitwise AND

Recently, I used bitwise Anding in my grails project. I am sharing the approach that we followed by means of an example. Suppose we have a domain class Person which can have multiple attributes like Smart, Intelligent, Talkative etc. What sort of relationship comes to our mind when we see this? I believe the obvious answer would...

by Mohd Farid
Tag: MySql
15-Apr-2011