[Lazarus] Is there a way to reconnect to postgresql if the connection fails?

Luca Olivetti luca at wetron.es
Tue May 15 20:59:23 CEST 2018


El 15/05/18 a les 20:44, Michael Van Canneyt ha escrit:

>>
>> Is there a way to force the closing of a connection in this case so I 
>> can try and reopen it again?
> 
> Try using forcedclose in SQLDb:
> 
> TheDatabase.Close(True);

Project project1 raised exception class 'EPQDatabaseError' with message:
PQConnection1: connection pointer is NULL
(PostgreSQL:)

In file 'fcl-db/src/sqldb/postgres/pqconnection.pp' ad line 725:
raise E;


TDatabase.DoDisconnect calls CloseDatasets which in turn calls
Unprepare (in TCustomSQLQuery.SetActive)->
FStatement.Unprepare->
DoUnprepare->
Database.UnPrepareStatement(FCursor)->
TPQConnection.UnprepareStatement which eventually fails.

Bye
-- 
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007


More information about the Lazarus mailing list