Have a couple of problems:
1) Have installed the dbExpress Driver but can't seem to find the reconnect options. I got the driver because my users are constantly running into network issues where they are disconnected and i need to be able to reconnect them painlessly. None of the demos that came with it seem to demo this feature.
2) Even After compiling the TCRSqlConnection and installing the component there does not seem to be an OnConnectionLost event. Is this the right component?
3) I bought the source but cannot compile it. It is looking for a unit called MTSCall.pas which doesn't seem to be present. Do I need to set some compiler directives?
I am using Delphi 2010 & Delphi XE2. Sql Server 2005 & 2008.
Problems with Driver. Won't Compile, can't reconnect.
Hello,
1 and 2. dbExpress drivers don't have the OnConnectionLost event, it is supported only in DAC products (such as SDAC, http://www.devart.com/sdac ). If you open a dataset (SQLQuery.Open) and a connection error occurs, dbExpress driver for SQL Server tries to reconnect. If it is possible, connection is established again.
3. In order to install dbExpress driver for SQL Server from Source Code, you should perform the steps that are described in the %dbExpress_Source_Unpack_Directory%\ReadMeSrc.txt file, where %dbExpress_Source_Unpack_Directory% is a directory to which you unpacked the source code.
1 and 2. dbExpress drivers don't have the OnConnectionLost event, it is supported only in DAC products (such as SDAC, http://www.devart.com/sdac ). If you open a dataset (SQLQuery.Open) and a connection error occurs, dbExpress driver for SQL Server tries to reconnect. If it is possible, connection is established again.
3. In order to install dbExpress driver for SQL Server from Source Code, you should perform the steps that are described in the %dbExpress_Source_Unpack_Directory%\ReadMeSrc.txt file, where %dbExpress_Source_Unpack_Directory% is a directory to which you unpacked the source code.
According to the dbExpress Divers Page (http://www.devart.com/dbx/) it should reconnect.1 and 2. dbExpress drivers don't have the OnConnectionLost event, it is supported only in DAC products (such as SDAC, http://www.devart.com/sdac ). If you open a dataset (SQLQuery.Open) and a connection error occurs, dbExpress driver for SQL Server tries to reconnect.
I did a test. I killed the connection before trying TClientDataSet.ApplyUpdates and yet I still got the communication link failure error. Are you saying it will only try to reconnect if I try to query first?
dbExpress driver for SQL Server cannot reconnect if there is an active transaction. When you perform ApplyUpdates, dbExpress driver for SQL Server starts a transaction. That's why automatic reconnection is not performed in case of ApplyUpdates. To avoid this problem, you can execute dummy query before performing ApplyUpdates. Here is a code example:
Code: Select all
SQLQuery1.SQL.Text := 'select 1';
SQLQuery1.Open; // here connection is reestablished (if it is possible) if it was lost
SQLQuery1.Close;
ClientDataSet1.ApplyUpdates(-1);