ODBC Connection Pooling
I have inherited a suite of .Net c# applications from a developer which talk to an Informix database on a unix server.
Instead of using the usual practices for managing the database connections (disposable pattern / "open late / close early"), the code seems to open one ODBC connection when each app loads and doesn't close it.
Is there any way of seeing how many ODBC connections are open?
I am trying to make a case for refactoring the code in the applications t开发者_JAVA百科o use .NET best practices but I am meeting with resistance because the current code works.
"but I am meeting with resistance because the current code works."
+1 for those giving the resistance.
If it really is the case that the required functionality is properly supported, and moreover there aren't any performance problems or so, then nothing is broken, and if nothing is broken, nothing needs to be fixed.
I've seen too many coding yuppies screw up working systems because they thought they knew a "better" way to organize the code.
If you are convinced that your way of organizing the code (your alleged "best practices") has any benefits compared to the one applied in the existing systems, demonstrate that to the business by applying it in a new project. If indeed there are noticeable benefits, then trust me, the users WILL notice. If there isn't, then you have been taught a very important lesson about the non-importance of "which way to code is the best".
you could enable ODBC tracing in the ODBC Administrator, start the application which should then open the pooled ODBC connections requested. Edit the ODBC trace file file and could the number of SQLConnect or SQLDriverConnect calls made to give the total number of ODBC connections made by the application. Any occurrences of SQLDisconnect indicates a connection was closed and this should be taken of the total number on connects ...
精彩评论