Category Archives: Sql

Update multi schema on REDSHIFT by command line

I. Install PostgresSQL via

  • Remember set enviroment variable on window: PGHOST = localhost

II. Install Cygwin via

III. Using Cygwin connect to PSQL

Create file .sh run on Cygwin follow below content. Remember when you using notepad++ to create file .sh YOU SHOULD change from Windows Format to UNIX Format.

  • PGOPTIONS behaves the same as the options connection parameter. We need this param because on redshift we have many schemas so before run query we need set search_path to schemas we want to update.
  • PGPASSWORD behaves the same as the password connection parameter. Use of this environment variable is not recommended for security reasons, as some operating systems allow non-root users to see process environment variables via ps; instead consider using the ~/.pgpass file
  • -U is username of Redshift cluster
  • -d is database name of Redshift
  • -p is port of Redshift
  • -h is host of Redshift

IV. Run file sh on Cygwin



Setup Mysql In Linux.

  • Update mysql service version up to 5.4 because default when install is 5.1

Multi database in framework SA2( Seasar 2).

Trong framwork SA2 kết nối với database thông qua các DataSource đã được định nghĩa sẵn bằng các file .dicon, nên khi muốn làm multi database chúng ta phải tạo sẵn các kết nối jdbc và số lượng database trước. Trước khi start server nó sẽ load tất cả các file .dicon đã được định nghĩa sẵn, và khi chúng ta muốn change qua 1 database khác thì chỉ việc gọi DataSource mà mình đã định nghĩa trong các file .dicon. Chi tiết sẽ được minh họa theo các bước bên dưới.

Continue reading Multi database in framework SA2( Seasar 2).

How to allow mysql client access to server linux ?

I used VMware and made CentOS 6.5 to server, after that on window I will access to mysql of server.

1. On Server create SSH key.

  • Get IP of server

2. On windown.

  • Copy ssh_key from server to window.
  • Install putty.

Download (PuTTY) here :

  • Open PUTTYGEN.exe and load file ssh_key > save private key name “my_key.ppk”
  • Config HeidiSQL follow image :

How to setup EC2 instance to deploy webserver on AWS ?

Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides resizable compute capacity in the cloud. It is designed to make web-scale computing easier for developers.

Amazon EC2’s simple web service interface allows you to obtain and configure capacity with minimal friction. It provides you with complete control of your computing resources and lets you run on Amazon’s proven computing environment. Amazon EC2 reduces the time required to obtain and boot new server instances to minutes, allowing you to quickly scale capacity, both up and down, as your computing requirements change. Amazon EC2 changes the economics of computing by allowing you to pay only for capacity that you actually use. Amazon EC2 provides developers the tools to build failure resilient applications and isolate themselves from common failure scenarios.

Go to

Continue reading How to setup EC2 instance to deploy webserver on AWS ?