v5:database:microsoft_sql_server
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
database:microsoft_sql_server [2015/11/26 19:03] – [Support Status] mnewnham | v5:database:microsoft_sql_server [2018/07/08 01:24] – mnewnham | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Microsoft SQL Server ===== | ====== Microsoft SQL Server ===== | ||
+ | ~~NOTOC~~ | ||
===== Description ===== | ===== Description ===== | ||
- | There are 2 supported drivers that allow connections to Microsoft SQL Server databases. | + | There are 2 supported drivers that allow connections to Microsoft SQL Server databases. |
+ | ==== mssqlnative | ||
+ | This driver, which runs on both Windows and Linux clients, | ||
- | ===== Support Status ===== | + | More about the Microsoft SQL Server client for Linux [[https:// |
- | This driver is actively supported by ADOdb project members | + | |
+ | ==== mssql==== | ||
+ | This allows connections from Unix based clients using the freetds libraries. It can be used with version 5.x of PHP | ||
+ | |||
+ | More about the FreeTDS libraries [[http:// | ||
==== SQL Server 2003 ==== | ==== SQL Server 2003 ==== | ||
Connecting to SQL server 2003 creates a difficulty There is no support for native client connections, | Connecting to SQL server 2003 creates a difficulty There is no support for native client connections, | ||
+ | ------------------------------------ | ||
====== mssqlnative ====== | ====== mssqlnative ====== | ||
- | < | + | < |
+ | == Specification == | ||
+ | ^Driver Name|mssqlnative| | ||
+ | ^Data Provider|mssqlnative| | ||
+ | ^Status|Active((This driver is actively supported by ADOdb project members))| | ||
+ | ^Windows|Yes| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
+ | == Alternatives == | ||
+ | [[v5: | ||
+ | [[v5: | ||
+ | </WRAP> | ||
- | **This is the preferred driver for connecting to a SQL server database from Windows clients.** | + | **This is the preferred driver for connecting to a SQL server database from both Windows |
- | |Driver Name|mssqlnative| | + | The original |
- | |Status|Active| | + | * On Windows clients, |
- | |Windows|Yes| | + | * On Linux clients, PHP version 7.0 and higher is required. |
- | |Unix|No| | + | |
- | </ | + | |
- | This driver was contributed by Microsoft and provides connections to SQL server databases greater than version 2000. It requires PHP version 5.3 or greater, Microsoft native client software and the appropriate PHP driver. | + | |
Sequences are supported in native mode in SQL Sever 2012, and emulated in earlier versions. | Sequences are supported in native mode in SQL Sever 2012, and emulated in earlier versions. | ||
+ | -------------------------------- | ||
+ | ==== DateTime Fields ==== | ||
+ | The default behavior for the **PHP** mssqlnative driver is to return date/time fields as a PHP [[http:// | ||
- | {{tag>[SQL_Server windows active]}} | + | |
- | ====== mssql (Windows) | + | ( |
- | <WRAP left 300px box> | + | [date] |
- | |Driver Name|mssql| | + | [timezone_type] |
- | |Status|Deprecated| | + | [timezone] |
- | |Windows|Yes| | + | ) |
- | |Unix|No| | + | |
- | </WRAP> | + | |
- | This driver was the primary connection method to SQL Server databases up to PHP Version 5.2. The windows dll associated with this driver (php_mssql.dll) was removed from the standard PHP distribution in PHP Version 3. There is no community support for this driver. | + | |
- | {{tag>[SQL_Server windows deprecated]}} | + | However, in order to improve portability, |
- | ====== | + | |
- | <WRAP left 300px box> | + | |
- | **This is the preferred driver for connecting | + | |
- | |Driver Name|mssql| | + | In order to return the dateTime as an object, the following action is required: |
- | |Status|Active| | + | <code php> |
- | |Windows|No| | + | $db = ADONewConnection(' |
- | |Unix|Yes| | + | $db-> |
+ | $db-> | ||
+ | </ | ||
+ | |||
+ | ===== Unicode Strings ===== | ||
+ | You can set the character set to UTF-8 using: | ||
+ | <code php> | ||
+ | $db = ADONewConnection(' | ||
+ | $db-> | ||
+ | $db-> | ||
+ | </ | ||
+ | |||
+ | ===== Using Windows Authentication | ||
+ | To use Windows, instead of SQL Server authentication, | ||
+ | <code php> | ||
+ | $db = ADONewConnection(' | ||
+ | $db-> | ||
+ | </ | ||
+ | ------------------------------ | ||
+ | ===== How to create a connection under Linux ===== | ||
+ | Establishing a connection | ||
+ | |||
+ | In the example, our database is running on a server 192.168.0.65: | ||
+ | < | ||
+ | # tsql -LH 192.168.0.65 | ||
+ | ServerName STUDY | ||
+ | | ||
+ | IsClustered No | ||
+ | Version 12.0.2000.8 | ||
+ | tcp 55644 | ||
+ | np \\STUDY\pipe\MSSQL$SQLEXPRESS\sql\query | ||
+ | </ | ||
+ | The response from the command tells us the | ||
+ | | ||
+ | | ||
+ | |||
+ | We can now create a connection string: | ||
+ | |||
+ | <code php> | ||
+ | $db = ADONewConnection(' | ||
+ | $db-> | ||
+ | </ | ||
+ | -------------------------------------- | ||
+ | |||
+ | ===== mssql (Unix) ===== | ||
+ | <WRAP right box round 300px> | ||
+ | == Specification == | ||
+ | ^Driver Name|mssql| | ||
+ | ^Data Provider|mssql| | ||
+ | ^Status|Active((This driver is actively supported by ADOdb project members))| | ||
+ | ^Windows|No| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
+ | == Alternatives == | ||
+ | [[v5: | ||
</ | </ | ||
+ | **This is the preferred driver for connecting to a SQL server database from Linux/Unix clients, when the PHP version is less than 7.0** | ||
This driver provides access to Microsoft SQL Server databases from unix systems via Freetds | This driver provides access to Microsoft SQL Server databases from unix systems via Freetds | ||
{{tag> | {{tag> | ||
- | ====== | + | -------------------------------------- |
- | < | + | ===== mssql (Windows) |
- | |Driver Name|mssqlpo| | + | <WRAP right box round 300px> |
- | |Status|Active| | + | == Specification == |
- | |Windows|No| | + | ^Driver Name|mssql| |
- | |Unix|Yes| | + | ^Data Provider|mssql| |
+ | ^Status|Obsolete((This driver will be removed in ADOdb version 6))| | ||
+ | ^Windows|Yes| | ||
+ | ^Unix|No| | ||
+ | ^ADOdb V5|Yes ((PHP Version 5.2 and lower))| | ||
+ | ^ADOdb V6|No| | ||
+ | </WRAP> | ||
+ | |||
+ | This driver was the primary connection method to SQL Server databases up to PHP Version 5.2. The windows dll associated with this driver (php_mssql.dll) was removed from the standard PHP distribution in PHP Version 5.3. There is no community support for this driver. | ||
+ | |||
+ | |||
+ | ---------------------------------------------------- | ||
+ | ===== mssqlpo ===== | ||
+ | <WRAP right box round 300px> | ||
+ | == Specification == | ||
+ | ^Driver Name|mssqlpo| | ||
+ | ^Data Provider|mssql| | ||
+ | ^Status|Inactive((This driver is not actively supported or enhanced by ADOdb project members, but you can provide fixes and enhancements if you have the expertise))| | ||
+ | ^Windows|No| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
</ | </ | ||
This driver provides undocumented portability extensions to the Unix mssql driver | This driver provides undocumented portability extensions to the Unix mssql driver | ||
Line 55: | Line 149: | ||
{{tag> | {{tag> | ||
- | ====== mssql_n | + | ===== mssql_n ===== |
- | < | + | < |
- | |Driver Name|mssqlpo| | + | == Specification == |
- | |Status|Deprecated| | + | ^Driver Name|mssqlpo| |
- | |Windows|No| | + | ^Data Provider|mssql| |
- | |Unix|Yes| | + | ^Status|Inactive((This driver is not actively supported or enhanced by ADOdb project members, but you can provide fixes and enhancements if you have the expertise))| |
+ | ^Windows|No| | ||
+ | ^Unix|Yes| | ||
+ | ^ADOdb V5|Yes| | ||
+ | ^ADOdb V6|Yes| | ||
</ | </ | ||
- | This driver appears to provide Unicode enhancements to the mssql driver | + | This driver appears to provide Unicode enhancements to the mssql driver. You can set character sets using the [[v5: |
- | {{tag>[SQL_Server unix deprecated | + | {{tag>[" |
v5/database/microsoft_sql_server.txt · Last modified: 2022/11/15 02:13 by mnewnham