This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi all, I've previously used J2EE data sources that support a "test on borrow" scheme. For instance with oracle you always run "select * from dual" to validate it's a good connection before it's used as this take 1-2 milliseconds. Is there a way to get equivalent functionality with SQL 2005 and Lightspeed? |
|
|
We don't have a built-in equivalent to this. However, if you have a particular command you want to run to verify the connection, you can create it as a Command object (in your case a SqlCommand) and attach it to the unit of work's connection by calling IUnitOfWork.PrepareCommand. When you subsequently Execute the command, it will run over the UOW's connection (opening it if required). |
|
|
Essentially I want the connection pool to refresh itself. That way if there is a database issue and the connection pipe is broken, I don't have to go through and roll all my Windows Services as well as our web site to re-initialize all their connections in the pool. This would make administering our systems significantly easier. Can I submit this as a feature request for LS 3? |
|
|
Hi Todd :) This is something that is fairly specific to the underlying ADO.NET providers, not really something that is a role of LightSpeed. For SQL Server you can call the static method - SqlConnection.ClearAllPools() to refresh the connection pool at any given time. I assume you are running up against something like a timeout issue with a connection in the pool? Have a look at this article for more info: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.clearallpools.aspx
Jeremy
|
|