Thursday, February 14, 2013

Postgres ODBC, Linked Server, SQL Server Reporting Services Connection

Connect to Postgres using ODBC connection follow these steps:
  1. Download Postgres ODBC driver from 
  2. Install above ODBC drivers
  3. Create system DSN ... On windows XP > Control Panel > Administrative Tools > Data Sources (ODBC)
  4. Go to System DSN Tab > Add > Select PostgresSQL Unicode sriver > Finish
  5. On Prompted page add
Data Source --- Whatever you want to name the DSN
Database - Name of postgres database
Server - Name of Postgres server
Port:5432 (or whatever you database port is..)
Username and Password: Enter postgres database username /password you wish to use

Test the System DSN by clicking on Test
  • Create Linked Server on SQL Server 2008/2005 to connect to postgres database
Start SQL server management studio
Connect to SQL server instance where who wish to create linked server
Go to ServerObject > linked Servers > New Linked Server
Fill the Linked server properties

Select Provider: Microsoft OLEDB Provider for ODBC Drivers
Product name: postgres (you can put whatever you like)
Data Source: Name of System DSN created in last step

Right click Linked Server and Test Connection
Now you query postgres from SSMS by something like

Wednesday, February 13, 2013

How to Restore Ubuntu Grub Bootloader after Reinstalling Windows

If you run a dual-boot system with Linux and Windows, this has happened to you. You had to do your monthly reinstall of Windows, and now you don’t see the linux bootloader anymore, so you can’t boot into Ubuntu or whatever flavor of linux you prefer.

Here’s the quick and easy way to re-enable Grub.

  1. Boot off the LiveCD
  2. Open a Terminal and type in the following commands, noting that the first command will put you into the grub “prompt”, and the next 3 commands will be executed there. Also note that hd0,0 implies the first hard drive and the first partition on that drive, which is where you probably installed grub to during installation. If not, then adjust accordingly.
sudo grub
> root (hd0,0)
> setup (hd0)
> exit
Reboot (removing the livecd), and your boot menu should be back.

Only read below if Windows is now missing from the boot menu