I am creating a MS Windows service, which listens for TCP connections. When connected, it gets data from a SQL db and returns it via the TCP socket. What are the drawbacks, if any, of opening a SqlConnection to the SQL Server at service start time, and just re-using that, until it might fail, as opposed to opening a new connection each time a "request" is made? I expect a small number of instantiations of the service functionality - less than 10 a day, but it could be more than that.
Are there drawbacks to leaving a SqlConnection open long-term?
140 Views Asked by Conrad At
1
There are 1 best solutions below
Related Questions in WINDOWS
- Get Maximum Log Size
- Debugging Windows Services while starting
- Possible consequences of duplicate ProgId for different classes
- How to chain BCryptEncrypt and BCryptDecrypt calls using AES in GCM mode?
- mingw-64 conflicting declarations when cross-compiling
- I run an EXE program from a Windows Service but I can't see form C#?
- Why is PowerShell "not recognized" when installing Chocolatey?
- How to check if Windows device is phone or tablet/pc?
- How to add directories to Cygwin gcc default search path
- Can't install anything with pip2 on Windows 7 due to UnicodeDecodeError
- Active directory and linux nslcd binding without extending the AD schema
- How To Prevent Over Scrolling in Scroll Viewer Windows Phone 8.1
- Unicode error from pip install
- Where is the 'EnablePinning' property in the ribbon framework's recent items?
- How can I implement the same models and data across ASP.NET and Windows Apps
Related Questions in SERVICE
- Debugging Windows Services while starting
- Error in Calling some service in WCF Client
- i want to create a service that does the login functionality?
- I run an EXE program from a Windows Service but I can't see form C#?
- Android check WIFI status (disconnected or user changed WIFI)
- Having two sequential steps running within a windows service
- Approach for performing long running tasks in .NET
- android - How to get a iBecon detection state when I kill app from Background?
- Symfony2 global function in entity
- Return more that one entity in RESTful response?
- angular unit testing $scope.$on in a service not working
- Are there drawbacks to leaving a SqlConnection open long-term?
- Android control music with headset buttons in a service
- Socket in service on Android writing to server but not reading
- What does the dot mean in Symfony service names?
Related Questions in ADO.NET
- Are there drawbacks to leaving a SqlConnection open long-term?
- Stored procedure's output parameters not updating
- An unhandled exception of type 'system.data.oledb.oledbexception'
- how to get current row index when reading DbDataReader in ADO.net
- Entity Framework throws Invalid object name
- Ignore max length property on ADO.NET DataTable
- How to fill two different datagrid from one mysql table in c#
- Ado.net running SQL Server stored procedure can't retrieve output value when using ExecuteReader
- DBConcurrency exception not occuring when data has been updated elsewhere
- Use wildcards in ado.net sybase parameter
- How to copy rows from a DataTable to another DataTable WITHOUT deleting existing rows?
- Use in operator in stored query in ms access with ado.net
- How to use entity framework with business objects
- ADO.Net INSERT not inserting data
- SQL Server 2012 - Bulk insert error - This operation conflicts with another pending operation on this transaction
Related Questions in SQLCONNECTION
- Are there drawbacks to leaving a SqlConnection open long-term?
- SqlCommand.CommandTimeout value ignored
- Passing Connection From TableAdapter Produces connectionstring property has not been initialized
- Storing Individual Values From List Box As Variables
- C# Identity UserManager CreateAsync then FindByEmailAsync returns User with Id=0
- SqlCommand closing connections properly
- Error "Object reference not set to an instance of an object." for SqlConnection
- VB.NET Using in Using
- Fill: SelectCommand.Connection error on derived iDBCommand
- SQL Connection Pool Exceding limit despite Finally blocks closing the connection
- P/Invoke CryptUnprotectData breaks SqlConnection constructor
- Database is not connected from webconfig file
- Returning multiple sqlcommands
- While more query executing, i got "Not allowed to change the 'ConnectionString' property."
- Secure DB connection function?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Database connections are considered an "expensive" resource, and as such should be opened only when needed, and closed immediately thereafter. As a result, opening a connection early and persisting it would go against that philosophy. Additionally, doing so prevents your underlying framework from making best use of whatever variety of connection pooling it may implement. It just isn't a very scalable practice.