SQLConnection open

  • Thread starter Thread starter Verena Doll
  • Start date Start date
V

Verena Doll

Hi NG,

i connect with a sqlconnection to my sqlserver.

Is it necessary to close the connection after i modified the data on the
server? Or can leave open the connection?

Thanks :-))
 
Hi.

If you leave the connection open, everything goes fine if the physical
connection is not lost (this is specially true in wireless environments, if
the signal level is too weak, the wireless interface may decide to drop the
connection). But the final answer depends on your scenario. You have to
identify a cycle of work in your app., that is, data is loaded, then sent
back to the server, and starts again with a new set of data. If you have
such cyclical operation, you can leave the connection open in order to use
it with no delay. If you disconnect and connect on every single cycle, you
have to wait several seconds in order to get the connection open to the back
end server. You may consider the concept of work session, where you connect
at the beginning and only disconnect when you decide to stop your work, or
move out of the hotspot coverage, etc.
On the data side, if you perform successfully an update command, then you
can assume that your data is effectively on the server. Closing your
connection doesn´t write your uncommitted data, but, if such behaviour
occurs, you must never rely on implicit behaviours, you always must perform
an explicit committment of your data.

Hope this help,

Carlos
 
Back
Top