Losing SQL Connection

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    Losing SQL Connection

    While working on a few projects I have this annoying issue whereby my
    computer is losing the connection to my SQL database. I have to save my
    work exit VS log out of windowsXP and log back in, relaunch VS and load my
    program to resume. I'm getting the following error about every 10 minutes.

    An unhandled exception of type 'System.Data.Sq lClient.SqlExce ption' occurred
    in system.data.dll

    Additional Information: System error.

    The error ocurrs on this line:
    SqlDataAdapter1 .Fill(ClientLis tDS1)

    I'm hoping someone can shed some light on what may be causing this. The SQL
    database is on a SBS2003 server.

    Thanks,
    Mike


  • Ken Tucker [MVP]

    #2
    Re: Losing SQL Connection

    Hi,

    Try enclosing the update command in a try catch block so you get
    a better error message.

    Try
    SqlDataAdapter1 .Fill(ClientLis tDS1)
    Catch ex as exception
    messagebox.show (ex.tostring)
    end try

    Ken
    ----------------
    "Mike" <thewittmer@yah oo.com> wrote in message
    news:CpOhe.9504 2$h6.70864@torn ado.texas.rr.co m...
    While working on a few projects I have this annoying issue whereby my
    computer is losing the connection to my SQL database. I have to save my
    work exit VS log out of windowsXP and log back in, relaunch VS and load my
    program to resume. I'm getting the following error about every 10 minutes.

    An unhandled exception of type 'System.Data.Sq lClient.SqlExce ption' occurred
    in system.data.dll

    Additional Information: System error.

    The error ocurrs on this line:
    SqlDataAdapter1 .Fill(ClientLis tDS1)

    I'm hoping someone can shed some light on what may be causing this. The SQL
    database is on a SBS2003 server.

    Thanks,
    Mike



    Comment

    • Zorpiedoman

      #3
      Re: Losing SQL Connection

      Or better yet catch a SQLexception type for the best info:

      Catch ex as SqlClient.SqlEx ception


      "Ken Tucker [MVP]" wrote:
      [color=blue]
      > Hi,
      >
      > Try enclosing the update command in a try catch block so you get
      > a better error message.
      >
      > Try
      > SqlDataAdapter1 .Fill(ClientLis tDS1)
      > Catch ex as exception
      > messagebox.show (ex.tostring)
      > end try
      >
      > Ken
      > ----------------
      > "Mike" <thewittmer@yah oo.com> wrote in message
      > news:CpOhe.9504 2$h6.70864@torn ado.texas.rr.co m...
      > While working on a few projects I have this annoying issue whereby my
      > computer is losing the connection to my SQL database. I have to save my
      > work exit VS log out of windowsXP and log back in, relaunch VS and load my
      > program to resume. I'm getting the following error about every 10 minutes.
      >
      > An unhandled exception of type 'System.Data.Sq lClient.SqlExce ption' occurred
      > in system.data.dll
      >
      > Additional Information: System error.
      >
      > The error ocurrs on this line:
      > SqlDataAdapter1 .Fill(ClientLis tDS1)
      >
      > I'm hoping someone can shed some light on what may be causing this. The SQL
      > database is on a SBS2003 server.
      >
      > Thanks,
      > Mike
      >
      >
      >
      >[/color]

      Comment

      • Mike

        #4
        Re: Losing SQL Connection

        It is returning:
        System.Data.Sql Client.SqlExcep tion: Cannot generate SSPI context.
        at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
        isInTransaction )
        at
        System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
        options, Boolean& isInTransaction )
        at System.data.Sql Client.SqlConne ction.Open()
        at System.Data.Com mon.DbDataAdapt er.QuietOpen(ID bConnection connection,
        ConnectionState & originalState)
        at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
        startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
        CommandBehavior )
        at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet)
        at WindowsApplicat ion2.Form1.Form 1_Load(Object sender, EventArgs e) in
        C:\vbdotnet\tes tapps\WindowsAp plication2\Form 1.vb:line1282

        That was a lot of typing. So, most search results indicate that this is a
        rights issue; however, I have tested various permission settings and have
        not been able to resolve the issue. Also, it doesn't occur right away. - I
        have access to the SQL data for about 10 minutes before I lose the
        connection. I have my username set in AD for 'Account is trusted for
        delegation' and the issue is reproducible while logged in as administrator
        as well..... I'm at a loss....

        Thanks,
        Mike
        "Ken Tucker [MVP]" <vb2ae@bellsout h.net> wrote in message
        news:OmEV6KaWFH A.1796@TK2MSFTN GP15.phx.gbl...[color=blue]
        > Hi,
        >
        > Try enclosing the update command in a try catch block so you
        > get
        > a better error message.
        >
        > Try
        > SqlDataAdapter1 .Fill(ClientLis tDS1)
        > Catch ex as exception
        > messagebox.show (ex.tostring)
        > end try
        >
        > Ken
        > ----------------
        > "Mike" <thewittmer@yah oo.com> wrote in message
        > news:CpOhe.9504 2$h6.70864@torn ado.texas.rr.co m...
        > While working on a few projects I have this annoying issue whereby my
        > computer is losing the connection to my SQL database. I have to save my
        > work exit VS log out of windowsXP and log back in, relaunch VS and load my
        > program to resume. I'm getting the following error about every 10
        > minutes.
        >
        > An unhandled exception of type 'System.Data.Sq lClient.SqlExce ption'
        > occurred
        > in system.data.dll
        >
        > Additional Information: System error.
        >
        > The error ocurrs on this line:
        > SqlDataAdapter1 .Fill(ClientLis tDS1)
        >
        > I'm hoping someone can shed some light on what may be causing this. The
        > SQL
        > database is on a SBS2003 server.
        >
        > Thanks,
        > Mike
        >
        >
        >[/color]


        Comment

        • Mike

          #5
          Re: Losing SQL Connection

          Thanks,
          I changed the catch statement but it returns the same results - see my
          response to Ken for details on the error.

          Thanks,
          mike

          "Zorpiedoma n" <nowheremane@be atles.com> wrote in message
          news:68D34DA3-1E9B-44BB-97E9-2EDCAFB24BB2@mi crosoft.com...[color=blue]
          > Or better yet catch a SQLexception type for the best info:
          >
          > Catch ex as SqlClient.SqlEx ception
          >
          >
          > "Ken Tucker [MVP]" wrote:
          >[color=green]
          >> Hi,
          >>
          >> Try enclosing the update command in a try catch block so you
          >> get
          >> a better error message.
          >>
          >> Try
          >> SqlDataAdapter1 .Fill(ClientLis tDS1)
          >> Catch ex as exception
          >> messagebox.show (ex.tostring)
          >> end try
          >>
          >> Ken
          >> ----------------
          >> "Mike" <thewittmer@yah oo.com> wrote in message
          >> news:CpOhe.9504 2$h6.70864@torn ado.texas.rr.co m...
          >> While working on a few projects I have this annoying issue whereby my
          >> computer is losing the connection to my SQL database. I have to save my
          >> work exit VS log out of windowsXP and log back in, relaunch VS and load
          >> my
          >> program to resume. I'm getting the following error about every 10
          >> minutes.
          >>
          >> An unhandled exception of type 'System.Data.Sq lClient.SqlExce ption'
          >> occurred
          >> in system.data.dll
          >>
          >> Additional Information: System error.
          >>
          >> The error ocurrs on this line:
          >> SqlDataAdapter1 .Fill(ClientLis tDS1)
          >>
          >> I'm hoping someone can shed some light on what may be causing this. The
          >> SQL
          >> database is on a SBS2003 server.
          >>
          >> Thanks,
          >> Mike
          >>
          >>
          >>
          >>[/color][/color]


          Comment

          • Armin Zingler

            #6
            Re: Losing SQL Connection

            "Mike" <thewittmer@yah oo.com> schrieb[color=blue]
            > It is returning:
            > System.Data.Sql Client.SqlExcep tion: Cannot generate SSPI context.
            > at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
            > isInTransaction )
            > at
            > System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
            > options, Boolean& isInTransaction )
            > at System.data.Sql Client.SqlConne ction.Open()
            > at System.Data.Com mon.DbDataAdapt er.QuietOpen(ID bConnection
            > connection, ConnectionState & originalState)
            > at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet, Int32
            > startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
            > CommandBehavior )
            > at System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet)
            > at WindowsApplicat ion2.Form1.Form 1_Load(Object sender, EventArgs
            > e) in C:\vbdotnet\tes tapps\WindowsAp plication2\Form 1.vb:line1282
            >
            > That was a lot of typing.[/color]

            Typing the callstack? Why not use the clipboard? :-)

            Maybe the people in the ADO.net group can help you:
            microsoft.publi c.dotnet.framew ork.adonet

            Armin

            Comment

            • Cor Ligthert

              #7
              Re: Losing SQL Connection

              Mike,

              I assume that you are creating and disposing all the time your connection.
              If not you can have a problem that there are to many connections active and
              have problems with the pooling.

              It can as well be your connectiontimeo ut.
              http://msdn.microsoft.com/library/de...meouttopic.asp

              I hope this helps,

              Cor


              Comment

              • Mike

                #8
                Re: Losing SQL Connection

                Thanks Cor,
                Disposing of the connection appears to have resolved the issue. I'm
                surprised that (1) using the wizard to create the connection doesn't take
                care of this automatically (2) the beginner books I am studying don't hit
                this point emmediately (they mayy touch on it later in the books).
                Nontheless, thank you for the help.

                Mike

                "Cor Ligthert" <notmyfirstname @planet.nl> wrote in message
                news:%23qMpw1qW FHA.1796@TK2MSF TNGP15.phx.gbl. ..[color=blue]
                > Mike,
                >
                > I assume that you are creating and disposing all the time your connection.
                > If not you can have a problem that there are to many connections active
                > and have problems with the pooling.
                >
                > It can as well be your connectiontimeo ut.
                > http://msdn.microsoft.com/library/de...meouttopic.asp
                >
                > I hope this helps,
                >
                > Cor
                >[/color]


                Comment

                Working...