Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member drews's Avatar
    Join Date
    Nov 2002
    Location
    St. Petersburg, Florida
    Posts
    63
    Member #
    341
    Hi all long time no post,

    I am running PHP 5.2.5 on Windows Server 2003, and Microsoft SQL Server 2005.

    I would like to install the PDO extension on PHP and use it for connecting to and interacting with SQL Server (as well as MySQL).

    I know I need to install the base PDO extension, but then there I get confused on PDO driver to load for interaction with MSSQL. php.net tells me that the DBLIB extension on windows is not good, and that I should use PDO_ODBC. Then researching this some more, I see some sites referencing PDO_
    MSSQL, but I can't find this anywhere on php.net's site.

    So after I load the appropriate driver, what would my initial connection string look like? Some sites, load the odbc driver and then call something like:
    PHP Code:
    $dbh = new PDO('mssql:host=localhost;dbname=test'$user$pass); 
    but other sites use ODBC instead of MSSQL, and some sites use DBLIB.

    So if someone can clarify with extension to use and then what the appropriate initial connection would look like, I would really appreciate it.

    Thanks!
    -drews
    -White Fiber Hosting - Coming Soon!

  2.  

  3. #2
    Junior Member
    Join Date
    Dec 2002
    Location
    chennai , tamil nadu , India
    Posts
    13
    Member #
    384
    If you have already created the data source name then

    odbc_connect("$dsn",$user,$password) should do it !
    Chris, Developer, Chrisranjana.com
    Software developers,
    Php and RoR programmers,
    http://www.chrisranjana.com


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:55 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com