Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

pdo connection string to sqlserver

Posted on 2008-06-11
5
1,061 Views
Last Modified: 2008-06-16
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
Comment
Question by:mohr4000
  • 2
  • 2
5 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 21758834
0
 
LVL 9

Assisted Solution

by:Rob Siklos
Rob Siklos earned 250 total points
ID: 21760492
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
 

Author Comment

by:mohr4000
ID: 21760811
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
 
LVL 9

Assisted Solution

by:Rob Siklos
Rob Siklos earned 250 total points
ID: 21760878
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
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 250 total points
ID: 21767009
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question