[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1067
  • Last Modified:

pdo connection string to sqlserver

hi all,
does pdo supports sqlserver to connect to if so please send me the pdo statement that support it  on php 5.2
please reply as soon as possible
best regards
mohr4000
0
mohr4000
Asked:
mohr4000
  • 2
  • 2
4 Solutions
 
Rob SiklosCommented:
If you are running php on Windows, DO NOT use the PDO_DBLIB driver.  From the web page:

"On Windows, you should use the PDO_ODBC  driver to connect to Microsoft SQL Server and Sybase databases, as the native Windows DB-LIB is ancient, thread un-safe and no longer supported by Microsoft. "

So, if you *are* running PHP on Windows, set up an ODBC connection to your SQL Server, and use the PDO_ODBC driver to connect.

Let me know if you need more info.
0
 
mohr4000Author Commented:
hi rob263,
thanks for reply,
but I'm using linux fedora core does dblib works fine on it to connect to MSSQLSERVER
if not do you have another way
best regards
hatem
0
 
Rob SiklosCommented:
Well, in addition to the warning about not using it on Windows, the page does say (in a big red box) that the extension is Experimental.  I would still try it though, since it uses FreeTDS, which has been around for a while.

If it doesn't work, you can always fall back on ODBC, but even that may have problems (see http://www.php.net/manual/en/ref.pdo-odbc.php#81488)
0
 
hernst42Commented:
Yes pdo-dblib can be compiled against free tds on linux to connect to a windows SQl-Server. It's described in my first link.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now