Is it acceptable to keep a db connection open for the life of the page?

前端 未结 10 1945
执念已碎
执念已碎 2021-01-18 07:11

Everybody knows that you should close a connection immediately after you finish using it.

Due to a flaw in my domain object model design, I\'ve had to leave the conn

10条回答
  •  北荒
    北荒 (楼主)
    2021-01-18 07:47

    Yes, it is ok.

    Closing the connection as soon as you can is a best practice for preventing orphan open connections, but if you are sure that the connection is being close, there is nothing wrong with that.

提交回复
热议问题