title: Opening the database connection once or on every databaseaction?
body: <p>Im currently creating a webportal with ASP.NET which relies heavily on database usage. Basically, every (well almost every :P ) GET query from any user will result in a query to the database from the webserver.</p>
  
  <p>Now, I'm really new at this, and I'm very concerned about performance. Due to my lack of experience in this area, I don't really know what to expect.</p>
  
  <p>My question is, using ADO.NET, would it be a smarter choice to just leave a static connection open from the webserver to the database, and then check the integrety of this connection serverside before each query to the database? - Or, would I be better off opening the connection before each query and then close it afterwards?</p>
  
  <p>In my head the first option would be the better as you save time handshaking etc. before each query and you save memory both on the database and the server side since you only have one connection, but are there any downfalls to this approach? Could 2 queries send at the same time potentially destroy each others integrity or mix the returned dataset?</p>
  
  <p>I've tried searching everywhere in here and on the web to find some best-practices about this, but with no luck. Closest I got was this: <a href="https://stackoverflow.com/questions/312702/is-it-safe-to-keep-database-connections-open-for-long-time">is it safe to keep database connections open for long time</a> , but that seems to be more fitting for distributed systems where you have more than one user of the database, whereas I only got my webserver..</p>