C
Chukkalove
Hi
Im newish with databases so I'd thought I'd ask a general question.
Im using a remote MySQL database accessed across the internet with dotnet
provider components.
The code I've written creates a new connection for each transaction on the
database then closes it again afterwards. So there are many
Connection.open/close during the lifetime of my application.
I'm wondering if I should be doing this or if I should only open the
connection when my database wrapper object is instantiated and close it
when it is destroyed.
The reason I did it this way was because I was worried about loss of network
after the connection was opened.
I've no idea about what possible errors this would cause and also how to
write nice error handling for a constantly opened connection that dies
during the objects lifetime.
I also don't know what performance hits that constant opening and closing
would cause.
I would appreciate that someone with experience please advise me about how
to handle this.
thanks
Claire
Im newish with databases so I'd thought I'd ask a general question.
Im using a remote MySQL database accessed across the internet with dotnet
provider components.
The code I've written creates a new connection for each transaction on the
database then closes it again afterwards. So there are many
Connection.open/close during the lifetime of my application.
I'm wondering if I should be doing this or if I should only open the
connection when my database wrapper object is instantiated and close it
when it is destroyed.
The reason I did it this way was because I was worried about loss of network
after the connection was opened.
I've no idea about what possible errors this would cause and also how to
write nice error handling for a constantly opened connection that dies
during the objects lifetime.
I also don't know what performance hits that constant opening and closing
would cause.
I would appreciate that someone with experience please advise me about how
to handle this.
thanks
Claire