Skip to main content


Showing posts from November, 2012

SMTP Libcurl

Hi ,

Libcurl is a utility tool which we can also send e-mails using SMTP library. Below is a sample program which helps you to do the same from Linux-C Language.

Below is the program

#include <stdio.h>#include <string.h>#include <curl/curl.h>int main(void){  CURL *curl;  CURLcode res;  FILE *FP;  struct curl_slist *recipients = NULL;  static const char *from = "********";  static const char *to = "********";  FP=fopen("/tmp/Email","r");  curl = curl_easy_init();  if(curl) {    curl_easy_setopt(curl, CURLOPT_URL, "smtp://");    curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);    curl_easy_setopt(curl, CURLOPT_USERNAME, "");    curl_easy_setopt(curl, CURLOPT_PASSWORD, "*********");    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from);    recipients = curl_slist_append(recipients, to);    curl_easy_setopt(curl, CURLO…

Skytools - Londiste Replication

PGQ-Londiste Replication
We all know that the Skytools are popular PostgreSQL Replication tools which have been developed in C/Python and PL/PGSQL. Londiste is the replication which has been implemented on top of PGQ tool which is a snapshot based queuing mechanism. Londiste replication is a Consumer of PGQ which takes the all modifications from PGQ.

How to setup PGQ and Londiste Replication

PGQ is a queue mechanism which gathers all the transactions/modifications from the provider and keep them ready to consumers{Londiste Replication Demon}.

Step 1
Download the Skytool from the below link. -zxvf skytools-2.1.13.tar.gz
Step 2
Configure make and make install.

[root@localhost skytools-2.1.13]# ./configure  --prefix=/opt/PostgreSQL/9.2/Sky --with-pgconfig=/opt/PostgreSQL/9.2/bin/pg_config[root@localhost skytools-…



Foreign data wrapper is a library which understand the heterogeneous database information. For example, PostgreSQL does not understand the MYSQL data structure/information since both engines have different mechanism. If we want to get any heterogeneous database information then we need to configure the respective fdw(Foreign Data Wrapper) into the PostgreSQL Library location.

Please find the below link, which gives you all the available Foreign Data Wrappers.

Here we have chosen MYSQL table as a source to PostgreSQL. Below are the steps.

1) Install mysql and mysql-devel using yum .

yum install mysql* 2) Install PostgreSQL 9.1 through EnterpriseDB graphical installer. 3) Get the MYSQL FDW from the below link. 4) set the "PATH" as shown below. export PATH=<PostgreSQL 9.1 Bin>:<Mysql Bin>:$PATH;…