This article provides a brief overview of the NexusDB data access provider for UniDAC used to establish a connection to NexusDB databases from Delphi and Lazarus. You will find the description of some useful features and how to get started quickly.
The main features of the NexusDB data access provider are:
Both Professional and Standard Editions of UniDAC include the NexusDB provider. Express Edition of UniDAC does not include the NexusDB provider.
NexusDB provider is supplied with source code.
To learn about NexusDB compatibility, refer to the Compatibility section.
You should have installed NexusDB components for corresponding IDE.
NexusDB provider uses the following NexusDB libraries: NexusDBXXXdbXX, NexusDBXXXsdXX, NexusDBXXXllXX,
NexusDBXXXsrXX, NexusDBXXXptXX, NexusDBXXXtwXX, NexusDBXXXsqXX, NexusDBXXXseXX, NexusDBXXXstXX, NexusDBXXXreXX.
Before using the NexusDB provider, you have to rebuild and reinstall its provider package. You can find the detailed steps describing the installation of the package in the UniDAC_Install_Dir\Source\NexusDBProvider\Readme.html file, where UniDAC_Install_Dir is a directory where you installed UniDAC.
When an application was built without runtime packages (Link with runtime packages set to False in Project Options), you do not need to deploy any BPL files with it. If the option is set to True, you must deploy the package libraries listed in Deployment and additionally the following NexusDB libraries: NexusDBXXXdbXX, NexusDBXXXsdXX, NexusDBXXXllXX, NexusDBXXXsrXX, NexusDBXXXptXX, NexusDBXXXtwXX, NexusDBXXXsqXX, NexusDBXXXseXX, NexusDBXXXstXX, NexusDBXXXreXX.
Note that UniDAC Trial requires deployment of additional BPL files regardless of Link with runtime packages.
Though UniDAC is components that provide unified interface to work with different database servers, it also lets you tune behaviour for each server individually. For thin setup of a certain database server, UniDAC provides server-specific options. These options can be applied to such components as TUniConnection, TUniQuery, TUniTable, TUniStoredProc, TUniSQL, TUniScript via their SpecificOptions property. SpecificOptions is a string list.
To assign a value to a specific option, use the following syntax:
ComponentName.SpecificOptions.Values['OptionName'] := 'OptionValue';
For example:
UniConnection.SpecificOptions.Values['CommandTimeout'] := '10';
UniQuery.SpecificOptions.Values['FetchAll'] := 'True';
Below you will find the description of allowed options grouped by components.
Option name | Description |
---|---|
CommandTimeout | Specifies the elapsed time in seconds before an attempt to execute a command is considered unsuccessful. The default value is 15. |
ConnectionTimeout | Specifies the amount of time in seconds that can be expired before an attempt to make a connection is considered unsuccessful. |
DatabaseReadOnly | If True, no writing is required, allows for sharing databases between servers. |
HeartbeatInterval | Use the HeartbeatInterval option to specify how often the client will send a hearbeat message to the server. The default value is 10. |
LostConnectionTimeout | Specifies the amount of time in seconds that must expire before a connection is considered lost. The default value is 10. |
WatchdogInterval | Use the WatchdogInterval option to specify how often the client will check all connections. The default value is 10. |
Option name | Description |
---|---|
CommandTimeout | The time to wait for a statement to be executed. |
ReadOnly | Use the ReadOnly option to prevent users from modifying data in the database. The default value is False. |
Option name | Description |
---|---|
CommandTimeout | The time to wait for a statement to be executed. |
CursorUpdate | Specifies what way data updates reflect on database when modifying dataset by using server NexusDB cursors (the ServerCursor option is set to True). If True, all dataset modifications pass to database by server cursors. It increases performance but doesn't allow to use procedures or enhanced queries for additional data changes. If False, all dataset updates pass to server by SQL statements generated automatically or specified in SQLUpdate, SQLInsert or SQLDelete. The default value is True. |
FetchAll | When set to True, all records of the query are requested from the database server when dataset is being opened. When set to False, records are retrieved when a data-aware component or a program requests it. If a query can return a lot of records, set this property to False if initial response time is important. When the FetchAll property is False, the first call to Locate and LocateEx methods may take a lot of time to retrieve additional records to the client side. |
ReadOnly | Use the ReadOnly option to prevent users from updating, inserting, or deleting data in the dataset. By default, ReadOnly is False, meaning that users can potentially alter data stored in the dataset. To guarantee that users cannot modify or add data to a dataset, set ReadOnly to True. |
ServerCursor | By default, ServerCursor is False, meaning that NexusDB provider reads data to the own memory when dataset is opened. NexusDB provider performs all database operations using SQL statements generated automatically or specified in SQLUpdate, SQLInsert or SQLDelete. If True, then NexusDB provider calls server NexusDB cursor for resultset record access and then reads data from it. So, stored data aren't duplicated that allows you to decrease memory charges. Data to the server can be written using server cursor or SQL queries in dependence of CursorUpdate option. So the TCustomDADataSet.FetchRows, FetchAll, CachedUpdates properties don't have any influence on such cursors and only the CursorUpdate option does. |
The TUniScript component has no NexusDB-specific options.
Option name | Description |
---|---|
DirectLoad | If True, all inserted data pass to database by server NexusDB cursors. If False, all inserted data pass to server by SQL statements. The default value is True. |
The TUniDump component has no NexusDB-specific options.
The following table lists the constants for mapping NexusDB data types to Delphi data types. See Data Type Mapping for more information.
Constant | Description |
---|---|
nxBoolean | Maps Boolean to Delphi data types. |
nxChar | Maps Char to Delphi data types. |
nxWideChar | Maps WideChar to Delphi data types. |
nxByte | Maps Byte to Delphi data types. |
nxWord16 | Maps Word16 to Delphi data types. |
nxWord32 | Maps Word32 to Delphi data types. |
nxInt8 | Maps Int8 to Delphi data types. |
nxInt16 | Maps Int16 to Delphi data types. |
nxInt32 | Maps Int32 to Delphi data types. |
nxInt64 | Maps Int64 to Delphi data types. |
nxAutoInc | Maps AutoInc to Delphi data types. |
nxSingle | Maps Single to Delphi data types. |
nxDouble | Maps Double to Delphi data types. |
nxExtended | Maps Extended to Delphi data types. |
nxCurrency | Maps Currency to Delphi data types. |
nxDate | Maps Date to Delphi data types. |
nxTime | Maps Time to Delphi data types. |
nxDateTime | Maps DateTime to Delphi data types. |
nxInterval | Maps Interval to Delphi data types. |
nxBlob | Maps BLOB to Delphi data types. |
nxBlobMemo | Maps BLOB Memo to Delphi data types. |
nxBlobGraphic | Maps BLOB Graphic to Delphi data types. |
nxByteArray | Maps Byte Array to Delphi data types. |
nxShortString | Maps ShortString to Delphi data types. |
nxNullString | Maps NullString to Delphi data types. |
nxWideString | Maps WideString to Delphi data types. |
nxRecRev | Maps Recrev to Delphi data types. |
nxGuid | Maps GUID to Delphi data types. |
nxBCD | Maps BCD to Delphi data types. |
nxBlobWideMemo | Maps BLOB Wide Memo to Delphi data types. |
nxFmtBCD | Maps FmtBCD to Delphi data types. |