ODBC for SQL 2000

http://laravel.com/

http://kejyun.github.io/Laravel-4-Docum ... roduction/
回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

ODBC for SQL 2000

文章 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;

    }
}
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

Re: ODBC for SQL 2000

文章 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
回覆文章

回到「laravel」