odbc_mssql

“odbc_mssql” should only be used for DSN connection for Microsoft SQL Server in *nix or OS X operation system using unixODBC through FreeTDS protocol. You can learn more about how to use unixODBC with FreeTDS here

unixODBC

unixODBC requires additional environment variables in file conf.php

1
2
putenv("ODBCINSTINI=/usr/local/Cellar/unixodbc/2.3.1/etc/odbcinst.ini");
putenv("ODBCINI=/usr/local/Cellar/unixodbc/2.3.1/etc/odbc.ini");
 

FreeTDS

FreeTDS uses a configuration file called “freetds.conf”. Below is an sample of freetds.conf used by phpGrid during testing for your reference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/usr/local/Cellar/freetds/0.91/etc/freetds.conf

   # server specific section
    [global]
    # TDS protocol version
    ; tds version = 4.2

    # Whether to write a TDSDUMP file for diagnostic purposes
    # (setting this to /tmp is insecure on a multi-user system)
    ; dump file = /tmp/freetds.log
    ; debug flags = 0xffff

    # Command and connection timeouts
    ; timeout = 10
    ; connect timeout = 10

    # If you get out-of-memory errors, it may mean that your client
    # is trying to allocate a huge buffer for a TEXT field.
    # Try setting 'text size' to a more reasonable limit
    text size = 64512

    [phpgridmssql]
    host = phpgridmssql.cbdlprkhjrmd.us-west-1.rds.amazonaws.com
    port = 1433
    tds version = 7.0
   /usr/local/Cellar/unixodbc/2.3.1/etc/odbc.ini

   [phpgridmssql]
    Description = MS SQL Server
    Driver = FreeTDS
    Server = phpgridmssql.cbdlprkhjrmd.us-west-1.rds.amazonaws.com
    TraceFile = /tmp/sql.log
    UID = mssqluser
    PWD = PASSWORD
    ReadOnly = No
    Port = 1433
   Database = sampledb
   /usr/local/Cellar/unixodbc/2.3.1/etc/odbcinst.ini

   [FreeTDS]
    Description = FreeTDS
    Driver = /usr/local/Cellar/freetds/0.91/lib/libtdsodbc.so
    Setup = /usr/local/Cellar/freetds/0.91/lib/libtdsodbc.so
    FileUsage = 1
    CPTimeout =
    CPResuse =
    client charset = utf-8