Thursday, August 22, 2013

REPOST: Setting up PHP to connect to a MS SQL Server using PDO_ODBC in Ubuntu

For those who are not familiar of ODBC like I was, its basically an API that lets you connect to other databases. PDO has its ODBC driver which in turn ODBC has its own also. To connect to MS SQL Server, we are using FreeTDS which is a library that lets you accomplish this.

sudo apt-get install freetds-bin freetds-common tdsodbc odbcinst php5-odbc unixodbc
sudo cp /usr/share/tdsodbc/odbcinst.ini /etc/
sudo apache2ctl restart

Connect using PDO in PHP:
$c = new PDO('odbc:Driver=FreeTDS; Server=hostname_or_ip; Port=port; Database=database_name; UID=username; PWD=password;');
Note: You will not see any reference of FreeTDS (the odbc driver) in the ODBC section of your PHP Info so don't weird out.

Reference:
https://secure.kitserve.org.uk/content/accessing-microsoft-sql-server-php-ubuntu-using-pdo-odbc-and-freetds

9 comments:

Unknown said...

Sergei , October 22, 1970 Born in Christian Louboutin Bois Dore Moscow State Ozherelye. Perhaps influenced by Cheap LV Handbags their parents worship warrior army, join the army in cheap jordans 1989, and into the elite airborne military service. 1991, by the influence of the Soviet Union, the uggs on sale Russian christian louboutin army general lack of funds, a large number ugg australia of Air Jordan 11 Gamma Blue soldiers seeking veterans, but under extremely difficult conditions still dedicated, praise superiors, and soon was sent to the famous christian louboutin shoes Ryazan Higher ugg Airborne Command School studies. After graduating in 1994, entered the famous Pskov 76th Guards Airborne discount christian louboutin Division, served as discount nike jordans the reconnaissance platoon, reconnaissance ugg soldes deputy company commander, company commander, battalion airborne regiment scouting director and other duties.From 2000 to Cheap Louis Vuitton Handbags 2004, where the forces have repeatedly ordered war with Chechen militants. Because of their opponents in order to form the squad activity and haunted impermanence, the Russians had to ugg boots mobilize elite troops set up large uggs outlet number of small units, "a Discount Louis Vuitton small wholesale jordan shoes play small" Implementation siege. commanding troops in Chechnya, Christian Louboutin Daffodile Ingushetia and other places over the mountains, to track the militants fled. Discount LV Handbags Although the militants were extremely vigilant, but as long as the task has never had outsmarted.August 8, 2008, Georgia suddenly invade South Ossetia (Russian peacekeepers stationed ugg pas cher there), the Russian military to respond quickly, including including the 76th Guards Airborne Division, more than christian louboutin remise 50% 3,000 people were immediately delivered to the pro-Russian Abkhazia, Georgia cheap nike jordan shoes Army contain two infantry brigades, effectively coordinate the cheap christian louboutin direction of the Russian Bags Louis Vuitton troops in South Ossetia.

Unknown said...

blake griffin jersey
nike trainers,nike trainers uk,cheap nike trainers,nike shoes uk,cheap nike shoes uk
soccer jerseys
rolex watches,swiss watch,replica watches,rolex watches for sale,replica watches uk,rolex watches replica,rolex watches for sales
moncler jackets
canada goose outlet
nike outlet store
mulberry handbags
raiders jerseys
cheap nhl jerseys
nhl jerseys
nike huarache
peyton manning jersey,eric decker jersey,aqib talib jersey,emmanuel sanders jersey,shannon sharpe jersey,louis vasquez jersey
san francisco 49ers jerseys
nike running shoes
true religion jeans
nike running shoes
north face outlet store
tim tebow jersey,julian edelman jersey,darrelle revis jersey,vince wilfork jersey,tom brady jersey,rob gronkowski jersey,deion branch jersey,jerod mayo jersey,danny woodhead jersey
lebron james shoes,lebron 12,lebron 12 shoes,lebron sneakers,lebron iv,lebron 11,lebron 10
dan marino jersey,louis delmas jersey,brent grimes jersey,cameron wake jersey,mike wallace jersey,dan marino jersey,cameron wake jersey
chelsea football shirts
chicago bears jerseys
air max 2014
hermes outlet store
barcelona jersey
burberry sale
cheap oakley sunglasses
spurs jersey
air jordan shoes
miami heat jersey
coach outlet store
soccer shoes
nike trainers uk
baltimore ravens jerseys
zhuweiming0627

Unknown said...

cheng0928
louis vuitton handbags, http://www.louisvuittonhandbag.us/
hermes birkin, http://www.hermesbirkin.org/
mbt shoes, http://www.mbtshoesoutlet.us.com/
swarovski outlet, http://www.swarovski-outlet.co.uk/
hogan, http://www.scarpehogan-outlet.it/
ray ban, http://www.occhiali-rayban.it/
nfl jerseys wholesale, http://www.nfljerseys-wholesale.us.com/
nba jerseys, http://www.nbajerseys.us.com/
longchamp handbags, http://www.longchamphandbag.us.com/
cheap nhl jerseys, http://www.nhljerseys.us.com/
cheap mlb jerseys, http://www.cheapmlbjerseys.net/
north face jackets, http://www.thenorthfaces.in.net/
cheap snapbacks, http://www.cheapsnapbacks.us.com/
adidas wings, http://www.adidaswings.net/
basketball shoes, http://www.basketballshoes.us.com/
lebron james shoes, http://www.lebronjamesshoes.in.net/
lacoste polo shirts, http://www.lacostepoloshirts.cc/
vans shoes, http://www.vans-shoes.cc/
ugg boots, http://www.uggboot.com.co/
hermes belt, http://www.hermesbelts.us/

chenlina said...

chenlina20151127
tory burch outlet
ugg boots
ugg boots
ugg outlet
ralph lauren outlet
louis vuitton handbags
coach outlet store online
ray ban sunglasses
coach factory outlet online
abercrombie kids
louis vuitton
ugg boots outlet
ray ban sunglasses
oakley sunglasses
polo ralph lauren
michael kors handbags
instyler max
coach outlet
the north face uk
ugg boots for women
air max 90
coach outlet online
true religion jeans outlet
cheap uggs
ugg sale
timberland outlet
uggs sale
uggs outlet
michael kors outlet
cheap toms
cheap uggs
ugg boots
louis vuitton outlet
louis vuitton
toms outlet
louis vuitton
prada handbags
abercrombie
ray ban sunglasses outlet
ralph lauren outlet
as

Digital Marketing Agency said...


Quicken Support Phone Number
Quicken Support Phone Number
Quicken Support Number
Quicken Tech Support Number
Quicken Tech Support Phone Number
Quicken Technical Support Number
Quicken Technical Support Phone Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Tech Support Number

Unknown said...

hermes belts
christian louboutin outlet
omega watches
nike blazer pas cher
michael kors handbags
buffalo bills jerseys
air jordan uk
indianapolis colts jerseys
mont blanc pens
fitflops sale clearance

caiyan said...

packers jerseys
coach outlet store online
cheap nfl jerseys
coach outlet store online
coach outlet online
adidas nmd runner
cheap oakley sunglasses
ray ban sale
louboutin outlet
yeezy boost 350
0412shizhong

Unknown said...

nike air max online
north face jackets
prada handbags
ralph lauren outlet
ray ban sunglasses sale
ysl bags
nike huarache black
oakley sunglasses wholesale
christian louboutin sale
lebron 13 shoes
2017.6.27chenlixiang

Digital Marketing Agency said...

Quikcbooks Support Phone Number

Quikcbooks Support Number
Quikcbooks Support Phone Number
Quikcbooks Tech Support Number
Quikcbooks Technical Support Number
Quikcbooks Tech Support Phone Number
Quikcbooks Technical Support Phone Number
Quikcbooks Helpdesk Phone Number
Quikcbooks Customer Service Phone Number
Quikcbooks Customer Service Number
Quikcbooks Customer Support Number

Quicken Support Phone Number

Quicken Support Number
Quicken Support Phone Number
Quicken Tech Support Number
Quicken Technical Support Number
Quicken Tech Support Phone Number
Quicken Technical Support Phone Number
Quicken Helpdesk Phone Number
Quicken Customer Service Phone Number
Quicken Customer Service Number
Quicken Customer Support Number

Sage Support Phone Number

Sage Support Number
Sage Support Phone Number
SageTech Support Number
Sage Technical Support Number
Sage Tech Support Phone Number
Sage Technical Support Phone Number
Sage Helpdesk Phone Number
Sage Customer Service Phone Number
Sage Customer Service Number
Sage Customer Support Number