How to properly close ODP.net connection : dispose() or close()?

前端 未结 4 516
梦谈多话
梦谈多话 2021-01-14 16:42

this is my powershell code :

[void][System.Reflection.Assembly]::LoadFile(\"C:\\DLL\\Oracle.ManagedDataAccess.dll\")
$OracleConnexion = New-Object Oracle.Ma         


        
4条回答
  •  Happy的楠姐
    2021-01-14 17:12

    Close closes the connection and allows you to reopen it again.

    Dispose closes the connection if it hasn't been closed and also disposes of it so you can't reopen it again.

    Use dispose - dispose frees up memory of a resource, if that resource is open, then a well behaved .dispose method will close the resource.

    Dispose() vs. Close() with ConnectionPooling: https://community.oracle.com/thread/165664?start=0&tstart=0

提交回复
热议问题