[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'SQLDB' (#fcl)

# TSQLConnection

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

An abstract class representing a connection to a SQL Database

## Declaration

Source position: sqldb.pp line 185

`type TSQLConnection = class(TDatabase)`
`public`
`constructor Create(); override;` |  | Create a new instance of TSQLConnection
`destructor Destroy; override;` |  | Destroys the instance of the connection.
`procedure StartTransaction; override;` |  | Start the Transaction associated with this Connection
`procedure EndTransaction; override;` |  | End the Transaction associated with this connection
`procedure ExecuteDirect();` |  | Execute a piece of SQL code directly, using a Transaction if specified
`function GetObjectNames(); virtual;` |  | Return a collection of object names for a given type of object
`procedure GetTableNames(); virtual;` |  | Get a list of the tables in the specified database
`procedure GetProcedureNames(); virtual;` |  | Gets a list of Stored Procedures in the Database
`procedure GetFieldNames(); virtual;` |  | Gets a list of the field names in the specified table
`procedure GetSchemaNames(); virtual;` |  | Get database schema names
`procedure GetSequenceNames(); virtual;` |  | Return a list of sequence names
`function GetConnectionInfo(); virtual;` |  | Return some information about the connection
`function GetStatementInfo(); virtual;` |  | Get statement information
`procedure CreateDB; virtual;` |  | Create a new Database on the server
`procedure DropDB; virtual;` |  | Procedure to drop or remove a Database
`function GetNextValue(); virtual;` |  | Get next value for a sequence
`property ConnOptions: TConnOptions; [r]` |  | The set of Connection options being used in the Connection
`property Handle: Pointer; [r]` |  | Low level handle used by the connection.
`property FieldNameQuoteChars: TQuoteChars; [rw]` |  | Characters used to quote field names.
`published`
`property Password: string; [rw]` |  | Password used when authenticating on the database server
`property Transaction: TSQLTransaction; [rw]` |  | Default transaction to be used for this connection
`property UserName: string; [rw]` |  | The username for authentication on the database server
`property CharSet: string; [rw]` |  | The character set to be used in this database
`property HostName: string; [rw]` |  | The name of the host computer where the database resides
`property OnLog: TDBLogNotifyEvent; [rw]` |  | Event handler for logging events
`property LogEvents: TDBEventTypes; [rw]` |  | Filter for events to log
`property Options: TSQLConnectionOptions; [rw]` |  | Options to observe for this connection.
`property Role: string; [rw]` |  | Role in which the user is connecting to the database
`property Connected: Boolean;` |  | Is a connection to the server active or not
`property DatabaseName: string;` |  | The name of the database to which connection is required.
`property KeepConnection: Boolean;` |  | Attempt to keep the connection open once it is established.
`property LoginPrompt: Boolean;` |  | Should SQLDB prompt for user credentials when a connection is activated.
`property Params: TStrings;` |  | Extra connection parameters
`property OnLogin: TLoginEvent;` |  | Event handler for login process
`end;`

## Inheritance

`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

TSQLConnection is an abstract class for making a connection to a SQL Database. This class will never be instantiated directly, for each database type a descendent class specific for this database type must be created.

Most of common properties to SQL databases are implemented in this class.

## See also

TSQLQuery |  | Class to handle SQL commands (with or without result set)
TSQLTransaction |  | Transaction in which a TSQLQuery is handled

Documentation generated on: May 14 2021