[Overview][Types][Classes][Variables][Index] | Reference for unit 'mssqlconn' (#fcl)

# TMSSQLConnection

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Microsoft SQL Server database connector

## Declaration

Source position: mssqlconn.pp line 59

`type TMSSQLConnection = class(TSQLConnection)`
`public`
`constructor Create(); override;`
`function GetConnectionInfo(); override;`
`procedure CreateDB; override;`
`procedure DropDB; override;`
`published`
`property Password: string;`
`property Transaction: TSQLTransaction;`
`property UserName: string;`
`property CharSet: string;`
`property HostName: string;` |  | Host and optionally port or instance
`property Connected: Boolean;`
`property Role: string;`
`property DatabaseName: string;`
`property KeepConnection: Boolean;`
`property LoginPrompt: Boolean;`
`property Params: TStrings;`
`property OnLogin: TLoginEvent;`
`end;`

## Inheritance

`TMSSQLConnection` |  | Microsoft SQL Server database connector
`TSQLConnection` |  | An abstract class representing a connection to a SQL Database
`TDatabase` |  | Base class for connecting a FreePascal application to an external Database engine
`TCustomConnection` |  | Abstract class for connections to a server
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent,IFPObserved`
`TObject`

## Description

Connector to Microsoft SQL Server databases.

Requirements:

MS SQL Server Client Library is required (ntwdblib.dll)

- or -

FreeTDS (dblib.dll)

Older FreeTDS libraries may require freetds.conf: (http://www.freetds.org/userguide/freetdsconf.htm)

[global]

tds version = 7.1

client charset = UTF-8

port = 1433 or instance = ... (optional)

dump file = freetds.log (optional)

text size = 2147483647 (optional)

Known problems:

- CHAR/VARCHAR data truncated to column length when encoding to UTF-8 (use NCHAR/NVARCHAR instead or CAST char/varchar to nchar/nvarchar)

- Multiple result sets (MARS) are not supported (for example when SP returns more than 1 result set only 1st is processed)

- DB-Library error 10038 "Results Pending": set TSQLQuery.PacketRecords=-1 to fetch all pending rows

- BLOB data (IMAGE/TEXT columns) larger than 16MB are truncated to 16MB: (set TMSSQLConnection.Params: 'TEXTSIZE=2147483647' or execute 'SET TEXTSIZE 2147483647')

Documentation generated on: Feb 26 2014