[Overview][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 51

`type TMSSQLConnection = class(TSQLConnection)`
`public`
`constructor Create(); override;` |  | Create a new instance of TMSSQLConnection
`function GetConnectionInfo(); override;` |  | Return some information about the connection
`procedure CreateDB; override;` |  | Create a new MS SQL database
`procedure DropDB; override;` |  | Drop a MS SQL database
`published`
`property Password: string;`
`property Transaction: TSQLTransaction;` |  | Default transaction
`property UserName: string;`
`property CharSet: string;`
`property HostName: string;` |  | Host and optionally port or instance
`property Connected: Boolean;` |  | Is the connection active
`property Role: string;` |  | Role for user
`property DatabaseName: string;`
`property KeepConnection: Boolean;` |  | Keep connection alive
`property LoginPrompt: Boolean;` |  | Show login prompt
`property Params: TStrings;`
`property OnLogin: TLoginEvent;` |  | Called when logging in
`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: May 14 2021