.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Cannot timeout connections when a network outage occurs

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Hi, We are running SQL Server 2008 in a mirrored configuration.  Client access is performed using the Microsoft JDBC 2.0 driver, configured to failover to the Mirror in the event the Primary database is unavailable.  Additionally, the client maintains a database connection pool using Apache DBCP's BasicDataSource.  During testing, we have found that the failover works flawlessly if either the primary Database is taken offline or the primary SQL Server service is stopped - attempts to use existing pooled connections to the primary database fail immediately and new connections are created to the mirror database. However, when simulating a network failure (by disabling the network interface on the SQL Server machine) things aren't so nice.  The client first attempts to use an existing pooled connection to the primary database.  At this point the client hangs for up to 15 minutes before failing with the following error: Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection timed out         at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368)         at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1355)         at com.microsoft.sqlserver.jdbc.TDSChannel.r

View Complete Post

More Related Resource Links

How to get connections from outside the network uscing TcpChannel?

My original test code:
System.Collections.Hashtable properties = new System.Collections.Hashtable();
            properties["bindTo"] = ""; //my local ip (01)
            properties["port"] = 1; //port to use

            channel = new TcpServerChannel(properties, new BinaryServerFormatterSinkProvider());
            //channel = new TcpServerChannel("tcpIntegrationViewServer", 8082, new Bina

How to get connections from outside the network uscing TcpChannel?

My original test code:
System.Collections.Hashtable properties = new System.Collections.Hashtable();
            properties["bindTo"] = ""; //my local ip (01)
            properties["port"] = 1; //port to use

            channel = new TcpServerChannel(properties, new BinaryServerFormatterSinkProvider());
            //channel = new TcpServerChannel("tcpIntegrationViewServer", 8082, new BinaryServerFormatterSinkProvider()); //tried this (02)
            //channel = new TcpServerChannel(8082); //and this (03)

            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(Bla), "Bla", WellKnownObjectMode.Singleton);
For some reason I can't get it to work. What I want is a connection from outside the lan. It works perfect on lan.
Connections outside the lan are then "forwarded" to a the pc's IP in the lan; i.e. If I have IP Y in the lan, but i made the

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is no



 I keep getting the following error. I also added time out parameter in the connection stirng and it still did not help. Has any one faced similar issues.

Thanks in adavance.

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]

Using network login



Is anyone have sample code to set up log in page using network login?

For example: User Name(same as Network Login)

                     Password(Same as Network Login)

Your help is highly appreciated.

SQL 2008 timeout


I am recently getting a timeout exception when executing this method. This table stores images and it might be due to the size of the table. I have no idea! Help!


 Public Sub StoreFile(ByVal fileId As Integer, ByVal upload As Stream, ByVal connection As SqlConnection)
            Dim bufferLen As Integer = 8040
            Dim br As BinaryReader = New BinaryReader(upload)
            Dim chunk As Byte()
            chunk = br.ReadBytes(bufferLen)

            Dim cmd As SqlCommand = _
            New SqlCommand("UPDATE tblContactDocuments SET ContractDocument=@Buffer WHERE AutoID=@FileId", _
            cmd.CommandTimeout = 30
            cmd.Parameters.AddWithValue("@FileId", fileId)
            cmd.Parameters.Add("@Buffer", SqlDbType.VarBinary, bufferLen).Value = chunk

            Dim cmdAppend = New SqlCommand("UPDATE tblContactDocuments SET CONTRACTDOCUMENT.WRITE(@Buffer, NULL, 0) WHERE AutoID=@FileId", _
            cmdAppend.Parameters.AddWithValue("@FileId", fileId)
            cmdAppend.Parameters.Add("@Buffer", SqlDbType.VarBinary, bufferLen)
            chunk = br.ReadBytes(bufferLen)

            While (c

ReadXML Timeout


I am reading an XML file from an external URL and putting it into a dataset that is the populates a repeater. This works fine when I run it locally, however on the published web site I receive A connection attempt failed because the connected party did not properly respond after a period of time error messages.

However, if i type the URL directly into a browser, I get the XML file almost immeadately which leads me to believe that I am going about this the wrong way or I need to some how to extend the timeout period.

Here is my code:

Protected Sub ButtonValidate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonValidate.Click
        If Page.IsValid = False Then
        End If

        TableCellVATSIMIDResults.Text = "<br />VATSIM ID Validation Results for <i>" & TextBoxVATSIMID.Text & "</i>"
        Dim DataSetVATSIMValidation As New DataSet
        DataSetVATSIMValidation.ReadXml("http://cert.vatsim.net/cert/vatsimnet/idstatus.php?cid=" & TextBoxVATSIMID.Text)


<asp:Repeater runat="server" ID="RepeaterVATSIMValidation">
                    <HeaderTemplate />

Maximum memory for string ? . System.MemoryOutOfException Occurs when reading the Content of the fil



I have a C++ code which reads a file [vtk file - its similar to text file only]. and try to store it in string.

here's the code:

String^ ParallelProjectionRenderer::GetVolumeDataAsString(String^ FileName)

    vtkSmartPointer<vtkDataSetWriter> sWriter = vtkSmartPointer<vtkDataSetWriter>::New();

    String^ FileName = "D:\\Users\\...";

    char * sptName = static_cast<char *>(Marshal::StringToHGlobalAnsi(FileName).ToPointer());







    String^ result= File::ReadAllText(FileName);   [it breaks here with system.memoryoutofexception when the file size is huge]

    return result;


this code executes fine when the file size is less than 8mb.

I wanted to know whats the maximum memory allocated to the string.

As a workaround i skipped reading out in C++ code. and i tried to read the file contents in asp.net C# code and stor

WCF P2P: How To Design State Sharing in a Peer Network


Learn how you can peer-enable business applications by allowing them to share state in a serverless peer network.

Kevin Hoffman

MSDN Magazine July 2008

Wandering Code: Write Mobile Agents In .NET To Roam And Interact On Your Network


In artificial intelligence, an agent is a logical entity that has some level of autonomy within its environment or host. A mobile agent has the added capability that it can move between hosts. In this article Matt Neely brings mobile agents from the halls of academia to a dev shop near you.

Matt Neely

MSDN Magazine February 2006

Basic Instincts: Introducing ASP.NET Web Part Connections


When you begin to work with the Microsoft® . NET Framework 2. 0 and ASP. NET, you discover that the new Web Parts infrastructure adds some very powerful functionality to the underlying platform. In the September 2005 issue of MSDN®Magazine, Fritz Onion and I have an article on programming Web Parts titled "ASP.

Ted Pattison

MSDN Magazine February 2006

SENS: System Event Notification Services and WMI Enable Flexible, Efficient Mobile Network Computing


Networked applications must deal with a host of connection problems ranging from timeouts to congestion to unavailability. If these applications can check the current connection status and, when disconnected, cache transmissions, they become more efficient. Fortunately, both the System Event Notification System (SENS) and Windows Management Instrumentation (WMI) can send notifications to keep applications informed of network status. In this article, the author explains the use of several SENS interfaces, including ISensNetwork and ISensLogon, which trigger events for connects/disconnects and logons/logoffs, respectively. The author then shows how you can subscribe to each of these events, and follows with a discussion of when you might use WMI events instead.

Aspi Havewala

MSDN Magazine August 2002

determine the best way to refresh a gridview when textchanged event occurs


Good afternoon.

I have the following gridview inside an updatepanel that makes the bind from a datatable:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <asp:Button ID="ButtonAdd" runat="server" OnClick="ButtonAdd_Click" Text="Novo Artigo" />
                <asp:GridView ID="Dados" runat="server" AutoGenerateColumns="False" 
                    CssClass="Grid" Width="100%" CellPadding="4" ForeColor="#333333" 
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <asp:Button ID="AbrirModal" runat="server" Text="->" /> 
                                <asp:PopupControlExtender ID="PopupControlExtender1" runat="server"

How to set session timeout and clear session in asp.net C# ? And kill session when close the web app


hi ,

How to set session timeout and clear session in web.config and login.aspx  ? And when we close the web application , the session must be cleared ?

I have use session.abandon as per below but is not working . Pls advise .


        protected void btnLogout_Click(object sender, EventArgs e)



Checkout/Chevk in issue in MOSS 2007 while connecting through VPN(virtual private network)


HI, I am using VPN connection . When I try modify a file and try to checkin the file in sharepoint document library it does not gets checked in. I get a message saying

"Unable to checkin the file, since File is being edited in Local Draft, please close the application or discard the checkout ".

Please do the needful....



Mulitiple Connections to Excel Sheet


I have a spreadsheet that I want to link to Sharepoint as a list.  I want to use Sharepoint to make updates to the spreadsheet as well as for lookups in other lists.

My problem is that the spreadsheet already has a data connection to a SQL database.  The spreadsheet doesn't update the DB directly but the DB connection is used to keep the spreadsheet updated with new data edited directly in the DB.  I don't own the DB or the spreadsheet so cannot convince them to do their editing another way (directly from the info in the spreadsheet for example) so ...I HAVE to keep the existing connection to the DB. 

My question is...is it possible to keep the connection to the DB AND link to Sharepoint?

OR..is there another solution? 

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend