Syntax error

Hi i am using PostgreSql database with Xadta and Aurelius TMS Components my Web application is working fine (Pure javascript) but there are many other connections on local intranet they share the same database (Desktop application Delphi) Postgresql is handle to use 200 max connections
I have two Questions
1. Its prefered on application Server each time is connected after a job close the current connection for example
  function TGetTokens.Getrequestname(Reqname:string): TList<TREQUEST>;
    begin
  Result := TXDataOperationContext.Current.GetManager.Find<TREQUEST>
     .Where((Linq['REQUESTID'] >  0) and     (Linq['REQUESTNAME'].Like(Reqname+'%')))
    .List;
    if TXDataOperationContext.Current.GetManager.Connection.IsConnected
  then
  TXDataOperationContext.Current.GetManager.Connection.Disconnect;

and
2.on my error log file i get this message sometimes
42601 syntax error at or near "version" [Uni Module] -> This is EDAError  on Unidac Connection On Error event
how can i trap the sql query text that revokes the error

Thank you Vagelis Bekyros
Hi Vagelis,

1. You don't need to explicitly disconnect the connection because it uses a connection pool. The connections won't reach maximum of the pool size. 

2. You can use OnSqlExecuting event to track all SQL statements executed by Aurelius:

But you can also try to get the execute SQL from Unidac or PostgreSQL, they are more "low-level" log.