1 頁 (共 1 頁)

ODBC for SQL 2000

發表於 : 2018-05-19 17:56:38
yehlu
https://stackoverflow.com/questions/226 ... erver-2000

代碼: 選擇全部

<?php

class SqlServerPdo {

    private static $dbName = 'dbName' ;
    private static $dbHost = '127.0.0.1';
    private static $dbUsername = 'username';
    private static $dbUserPassword = 'password';

    private static $conn  = null;

    public function __construct() {
        die('Init function is not allowed');
    }

    public static function connect() {
       // One connection through whole application
        if ( null == self::$conn ) {     
          try {

                   self::$conn = new PDO("odbc:Driver={SQL Server};Server=SERVER-NAME;Database=" . self::$dbName . ";User Id=" . self::$dbUsername . ";Password=" . self::$dbUserPassword . ";");

          } catch(PDOException $e) {

              die($e->getMessage());

          }
       }

       return self::$conn;

    }

    public static function disconnect() {

        self::$conn = null;

    }
}

Re: ODBC for SQL 2000

發表於 : 2018-05-20 15:10:27
yehlu
https://www.microsoft.com/en-us/downloa ... x?id=24793

Feature Pack for Microsoft SQL Server 2005

Microsoft ODBC Driver 10 for SQL Server

Support SQL 2000