Page 1 of 1

how to Disconnet while Connecting on Thread

Posted: Mon 22 Jun 2009 01:39
by munggaran
Hello,

I was connecting my TUniConnection under Thread because I don't want to freeze the form when the connection start, but I don't know how to cancel the connection itself just incase if user want to cancel without waiting until the connection timeout.

then I've tried to execute .Disconnect method but the does not affect the connection.

any idea ?

Posted: Mon 22 Jun 2009 06:43
by Plash
Please specify which DBMS you use.

Posted: Mon 22 Jun 2009 06:50
by munggaran
I'm sorry, it's PostgreSQL

Posted: Mon 22 Jun 2009 09:59
by Plash
UniDAC does not support cancelling a connection. You can just "forget" about the thread if user has canceled the operation. Thread will wait until the connection is established or exception is raised. Then you can end the thread. (Create new TUniConnection component for each connect).