Question

I keep a pool of Advantage TAdsConnection objects and hand them out as requested. Occasionally I get one passed out that results in a 6610 error, I'm assuming because it sat idle and the connection got reset. I could just run any old query and catch the 6610, but it's a long wait for that particular error.

Is there a good way to check the health of an advantage connection before I pass it back out?

Was it helpful?

Solution

You can use the AdsIsConnectionAlive ACE API to test a connection. This API will send a small 'echo' packet to the server to test if the connection is alive and well.

OTHER TIPS

IT is pretty much your friend on this one. I would set a reasonable time-out and remove your custom pooling (unless you absolutely need to pool because of an optimization). I'm going to file this one under "time out" as the probable issue. Replace your code (which I assume is a function call) with returning a new instance of a connection and see if you can replicate it.

You also have not specified the database version you're using. Advantage 6/7/8 had a lot more issues than 9/10 when I was dealing with that DB.

Assuming that your code isn't the problem (seriously, disable your custom pooling), check your network infrastructure and call support. Otherwise read the documentation on your TAdsConnection class: odds are you can increase the timeout both server and client side.

Short answer: I wouldn't pool manually, the database has an essence of that built in, use it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top