Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2004

Tip: Looking for answers? Try searching our database.

Sql Connection Opening but no Network Connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan S - 03 Aug 2004 21:13 GMT
In my application I have to account for the loss of Network connection - including someone disconnecting from the network by pulling the plug from the wall.  I am writing to a Sql Server database, when I can and if there is no network connection I write locally.  If I start up the application with no network connection, things run fine, I catch the SqlException when trying to make a connection and I proceded to write locally.  But if I disconnect from the network - by pulling the plug - in the middle of my app, as in a connection to the database was made and then closed, an SqlException is not raised when I open a new connection and I don't get any kind of exception until I do a DataAdapter.Read() or SqlCommand.ExecuteReader() type function call.  Any ideas?  Is this a connection pooling problem?  Is there a better way to see if a connection to the database can be made?

Thanks!

Signature

Dan S

Sijin Joseph - 04 Aug 2004 12:29 GMT
Hi Dan,

It's not a problem with connection pooling, when you make a Read() call, at
that time the framework tries to send data to the DB and since the
connection is not active you will get an exception. Why don't you try one
thing, when you catch an exception in Read() you can check the error code to
see if it is a connection problem and respond accordingly.

Signature

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> In my application I have to account for the loss of Network connection - including someone disconnecting from the network by pulling the plug from
the wall.  I am writing to a Sql Server database, when I can and if there is
no network connection I write locally.  If I start up the application with
no network connection, things run fine, I catch the SqlException when trying
to make a connection and I proceded to write locally.  But if I disconnect
from the network - by pulling the plug - in the middle of my app, as in a
connection to the database was made and then closed, an SqlException is not
raised when I open a new connection and I don't get any kind of exception
until I do a DataAdapter.Read() or SqlCommand.ExecuteReader() type function
call.  Any ideas?  Is this a connection pooling problem?  Is there a better
way to see if a connection to the database can be made?

> Thanks!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.