There are lots of applications that implement cancel by letting the UI continue while letting the backend proceed to a safe stopping point. There are ways to kill a connection, for example for mysql the following
http://dev.mysql.com/doc/refman/5.0/en/kill.html
I do not think it is a good idea to use this as a regular way to stop connections. Maybe you can design your application to:
1. use faster queries
2. use pagination or limit on the number of returned rows to complete faster
3. run the queries in a different thread, asynchronously and query from the browser in successive request
I hope this helps :)
Marius