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

17 comments:

Coach Factory said...

moncler outlet, cheap oakley sunglasses, canada goose outlet, oakley outlet, ugg boots, ray ban outlet, oakley sunglasses cheap, ray ban, ray ban outlet, ray-ban, oakley sunglasses outlet, oakley outlet, cheap oakley sunglasses, oakley vault, ray ban sunglasses outlet, canada goose, oakley vault, louboutin, tn pas cher, cheap oakley sunglasses, ray ban, canada goose, ray ban, ugg, oakley sunglasses outlet, ray bans, raybans, canada goose, oakley vault, ray-ban, oakley outlet, cheap sunglasses, ralph lauren, rayban, cheap oakley, moncler, oakley sunglasses cheap, gucci, oakley sunglasses outlet, moncler, oakley, canada goose, cheap sunglasses, ray bans, cheap sunglasses, oakley sunglasses cheap, moncler, canada goose outlet, rayban, discount oakley sunglasses

Coach Factory said...

jordan shoes, louboutin, michael kors outlet, michael kors, michael kors, louis vuitton handbags, nike air max, louis vuitton, gucci outlet, true religion outlet, michael kors outlet, air max, coach outlet store, ray ban sunglasses, burberry outlet online, michael kors, longchamp outlet, nike free, true religion jeans, burberry outlet online, coach factory outlet, louboutin, toms shoes, air jordan, polo ralph lauren, chanel handbags, ray ban, prada outlet, tiffany and co, nike air max, polo ralph lauren outlet, louboutin, coach outlet, nike shoes, ralph lauren, kate spade outlet, tory burch outlet, air max, oakley sunglasses, oakley sunglasses, true religion, michael kors outlet, oakley sunglasses, longchamp, prada handbags, nike free, coach purses, coach factory,

Coach Factory said...

celine handbags, chi flat iron, nike air max, nfl jerseys, ugg boots, lululemon, mcm handbags, marc jacobs, supra shoes, soccer shoes, lancel, beats by dre, vans, p90x3, ghd, herve leger, nike free, ferragamo shoes, burberry, birkin bag, juicy couture outlet, montre pas cher, soccer jerseys, ralph lauren, hermes, north face outlet, ugg boots, valentino shoes, louis vuitton, jimmy choo, new balance shoes, mulberry, rolex watches, louis vuitton, abercrombie and fitch, oakley pas cher, reebok outlet, hollister, air max, mont blanc, bottega veneta, converse shoes, ray ban pas cher, karen millen, wedding dresses, hogan, yoga pants, insanity, asics gel, timberland

co wendy 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

Wenhao Guo 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/

mmjiaxin said...

bears jerseys, http://www.chicagobearsjerseys.us/
barcelona jersey, http://www.barcelonajerseys.net/
air force 1 shoes, http://www.airforce1.us.com/
adidas wings shoes, http://www.adidaswings.net/
puma outlet, http://www.pumaoutletonline.com/
camisetas futbol baratas, http://www.futbol-baratas.com/
los angeles lakers jerseys, http://www.lakersjerseys.us/
swarovski crystal, http://www.swarovski.in.net/
minnesota vikings jerseys, http://www.minnesotavikingsjersey.us/
ysl outlet online, http://www.ysloutletonline.com/
pandora outlet, http://www.pandorajewelryoutlet.us.com/
prada outlet store, http://www.pradaoutlet.us/
pandora, http://www.pandora.eu.com/
tory burch outlet, http://www.toryburchshoesoutlet.com/
ed hardy outlet, http://www.edhardy.us.com/
golden state warriors, http://www.warriorsjersey.com/
roshe run men, http://www.rosherunshoessale.com/
kobe shoes, http://www.kobebryantshoes.in.net/
mizuno shoes, http://www.mizunorunningshoes.us/
michael kors outlet online, http://michaelkors.outletonlinestores.us.com/
mm1007

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

chenlina said...

chenlina20160127
coach outlet store online
hollister outlet
coach outlet store online
ugg outlet
true religion jeans sale
true religion outlet
uggs on sale
ugg boots
kate spade handbags
louis vuitton handbags
coach factory outlet online
air max 90
canada goose
ray ban sunglasses outlet
tory burch handbags
ralph lauren polo shirts
toms shoes
cheap ray ban sunglasses
cheap uggs
oakley sunglasses
ralph lauren outlet
coach outlet
kobe 10
replica rolex watches
giuseppe zanotti
louis vuitton handbags
cheap jerseys
cheap air max
cheap oakley sunglasses
official coach factory outlet
louis vuitton handbags
louis vuitton handbags
tods shoes
mulberry handbags
celine handbags
coach factory outlet
running shoes
canada goose jackets
michael kors outlet
timberland outlet
as

xjd7410@gmail.com said...

louis vuitton handbags uk
tory burch handbags
louis vuitton
canada goose
kate spade handbags
longchamp sac
kate spade handbags
coach factory outlet
ralph lauren uk
ugg slippers
canada goose outlet
louboutin pas cher
oakley sunglasses
lebron 13 shoes
louis vuitton
louis vuitton
mont blanc pens
tory burch handbags
gucci belts
ralph lauren
gucci outlet
christian louboutin outlet
jordan retro 3
timberland boots
lebron 11
jordan 4
louis vuitton handbags
toms outlet
nike outlet store
chenyingying2016811

Unknown said...

air max 90
louis vuitton handbags
air jordan 11
nike store uk
michael kors wallet
north face jacket
converse shoes
ralph lauren
reebok trainers
louis vuitton
toms shoes
canada goose jackets
mcm outlet
lululemon outlet
michael kors outlet
ralph lauren polo
swarovski crystal
burberry outlet
michael kors handbags
polo ralph lauren
louis vuitton
hollister canada
ugg boots
polo ralph lauren
tiffany and co
ralph lauren uk
rolex watches
celine outlet
rolex watches for sale
coach outlet clearance
polo ralph lauren
coach outlet store
true religion sale
longchamp handbags
michael kors outlet
chanyuan0913

roshini said...


Sage Support Phone Number
Sage 50 Tech Support Phone Number
Sage 50 Support Number
Sage 50 Technical Support Phone Number
Sage 50 Tech Support Number
Sage 50 Technical Support Phone Number
Sage 50 Technical Support Number
Sage 50 Customer Support Phone Number
Sage 50 Customer Service Number

Soni yadav said...

Aol Technical Support Phone Number
Aol Technical Support Number
Aol Tech Support Number
Aol Tech Support phone Number
Aol Support Phone Number
Aol Tech Support Number
Outlook Technical Support Phone Number
Outlook Technical Support Number
Outlook Tech Support Number
Outlook Tech Support Phone Number
Outlook Support Phone Number
Outlook Tech Support Number

Anjilo Jilo 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

mohan kumar said...

Quickbooks Support Phone Number
Quickbooks Payroll Support Phone Number
Quickbooks Payroll Tech Support Number
Quickbooks Payroll Support Number
Quickbooks Payroll Technical Support Number
Quickbooks Payroll Tech Support Phone Number
Quickbooks Payroll Technical Support Phone Number
Quickbooks Payroll Help Desk Phone Number
Quickbooks Payroll Help Desk Number
Quickbooks Payroll Customer Service Number
Quickbooks Payroll Customer Service Phone Number
Quickbooks Payroll Customer Support Number
Quickbooks Payroll Customer Support Phone Number

Kanika Jaiswal said...

QuickBooks Technician
Quickbooks Support Phone Number
Quickbooks Tech Support Number
Quickbooks Support Number
Quickbooks Technical Support Number
Quickbooks Tech Support Phone Number
Quickbooks Technical Support Phone Number
Quickbooks Customer Service Number
Quickbooks Customer Service Phone Number
Quickbooks Customer Support Number
Quickbooks Customer Support Phone Number
Quickbooks Help Desk Phone Number
Quickbooks Help Desk 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