ERROR Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.

Hi Guys
Microsoft SQL 2005
VB.Net 2003
I have written a vb.net project which runs every 2 minutes as a scheduled task.

After a few days I receive this error Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.

No one can access anything on SQL 2005. I have to restart the SQL Service.

I think it might be the code not closing database connections correctly.

This only occured since I inserted error trap code.

The code is below

I think this code is causing the stress and no where else.
That's because the code   sql = "Select * from Activation where Activated is null"
            OBJSQLdbcommand = New OleDb.OleDbCommand(sql, objConn)
            objdatareader = OBJSQLdbcommand.ExecuteReader
will not be null as there is nothing to activate yet.


Private Sub CheckLicenseKeyValidation()


   

        Dim strConnectionString As String = "Provider=sqloledb;Data Source=DSVR003226;Initial Catalog=Test;User Id=MASTER;Password=test;"
        Dim objConn As New System.Data.OleDb.OleDbConnection(strConnectionString)
        Dim objConn1 As New System.Data.OleDb.OleDbConnection(strConnectionString)
        Dim objConn2 As New System.Data.OleDb.OleDbConnection(strConnectionString)

        Dim objdatareader As OleDb.OleDbDataReader
        Dim objdatareader1 As OleDb.OleDbDataReader
        Dim objdatareader2 As OleDb.OleDbDataReader
        Dim objdatareader3 As OleDb.OleDbDataReader
        Dim objdatareader4 As OleDb.OleDbDataReader


        Dim OBJSQLdbcommand As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand1 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand2 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand3 As New System.Data.OleDb.OleDbCommand
        Dim OBJSQLdbcommand4 As New System.Data.OleDb.OleDbCommand


        Try

            objConn.Open()
            objConn1.Open()
            objConn2.Open()


            Dim sql As String
            Dim LicenceKey As String
            Dim Company As String
            Dim UserName As String
            Dim Email As String
            Dim Inform As String
            Dim Telephone As String
            Dim Mobile As String
            Dim Source As String
            Dim ProductCode As String
            Dim FirstName As String
            Dim LastName As String
            Dim Note As String

            Dim regSQL As String
            Dim regLicenceKey As String
            Dim regCompany As String
            Dim regUserName As String
            Dim regEmail As String
            Dim regInform As String
            Dim regTelephone As String
            Dim regMobile As String
            Dim regSource As String
            Dim regProductCode As String
            Dim regFirstName As String
            Dim regLastName As String
            Dim regNote As String
            Dim sqlProcess As String






            sql = "Select * from Activation where Activated is null"
            OBJSQLdbcommand = New OleDb.OleDbCommand(sql, objConn)
            objdatareader = OBJSQLdbcommand.ExecuteReader

            Do While objdatareader.Read()
                If objdatareader.IsDBNull(0) Then
                    LicenceKey = ""

                Else
                    LicenceKey = objdatareader.GetValue(0)
                End If


                If objdatareader.IsDBNull(1) Then
                    Company = ""

                Else
                    Company = objdatareader.GetValue(1)
                End If

                If objdatareader.IsDBNull(2) Then
                    FirstName = ""

                Else
                    FirstName = objdatareader.GetValue(2)
                End If

                If objdatareader.IsDBNull(3) Then
                    LastName = ""

                Else
                    LastName = objdatareader.GetValue(3)
                End If

                If objdatareader.IsDBNull(4) Then
                    Email = ""

                Else
                    Email = objdatareader.GetValue(4)
                End If

                If objdatareader.IsDBNull(5) Then
                    Inform = ""

                Else
                    Inform = objdatareader.GetValue(5)
                End If

                If objdatareader.IsDBNull(6) Then
                    Telephone = ""

                Else
                    Telephone = objdatareader.GetValue(6)
                End If

                If objdatareader.IsDBNull(7) Then
                    Mobile = ""

                Else
                    Mobile = objdatareader.GetValue(7)
                End If

                If objdatareader.IsDBNull(8) Then
                    Source = ""

                Else
                    Source = objdatareader.GetValue(8)
                End If

                If objdatareader.IsDBNull(9) Then
                    ProductCode = ""

                Else
                    ProductCode = objdatareader.GetValue(9)
                End If

                If objdatareader.IsDBNull(11) Then
                    Note = ""

                Else
                    Note = objdatareader.GetValue(11)
                End If



                UserName = FirstName & " " & LastName


                'Check if License key matches in EIB_Table1_Customer
                Dim sql2 As String
                Dim ActivationLicense As String
                Dim ActivationCompany As String


                sql2 = "Select Distinct License_Key,Company_Name from EIB_Table1_Customer where License_Key = '" & LicenceKey & "'"
                OBJSQLdbcommand1 = New OleDb.OleDbCommand(sql2, objConn1)
                objdatareader1 = OBJSQLdbcommand1.ExecuteReader
                Do While objdatareader1.Read()
                    If objdatareader1.IsDBNull(0) Then
                        ActivationLicense = ""
                    Else

                        ActivationLicense = objdatareader1.GetValue(0)
                    End If

                    If objdatareader1.IsDBNull(1) Then
                        ActivationCompany = ""
                    Else

                        ActivationCompany = objdatareader1.GetValue(1)
                    End If

                    SetActivation(LicenceKey)
                    InsertActivationFields(ActivationLicense, ActivationCompany, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    GenerateLicenceKey(ProductCode, Source, ActivationCompany, FirstName, LastName, Email, ActivationLicense)

                Loop
                'If objdatareader1.RecordsAffected = 0 Then

                sqlProcess = "Select Top 1 License_Key from EIB_Table2_Registration where License_Key = '" & LicenceKey & "' order by Date_Registered desc"
                OBJSQLdbcommand4 = New OleDb.OleDbCommand(sqlProcess, objConn2)
                objdatareader4 = OBJSQLdbcommand4.ExecuteReader
                Do While objdatareader4.Read()

                    If objdatareader4.IsDBNull(0) Then
                        ActivationLicense = ""
                    Else

                        ActivationLicense = objdatareader4.GetValue(0)
                    End If


                    SetActivation(LicenceKey)
                    InsertRegFields(ActivationLicense, Company, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    RegistrationDetails(LicenceKey, Company)
                    GenerateLicenceKey(ProductCode, Source, Company, FirstName, LastName, Email, ActivationLicense)
                Loop
                'End If

                If objdatareader4.RecordsAffected = 0 And objdatareader1.RecordsAffected = 0 Then
                    SetActivation(LicenceKey)
                    AddInvalidLicenceCustomer(LicenceKey, Company, UserName, Email, Inform, Telephone, Mobile, Source, ProductCode, "Yes", Note)
                    SendInvalidLicencemail(Company, UserName, LicenceKey, Email)
                End If
                objdatareader1.Close()
                objdatareader4.Close()














                'Close Form if nothing to Activate

                If LicenceKey = "" Then
                    'MsgBox("help")
                    Me.Close()
                Else





                End If

            Loop
            Me.Close()

        Catch exc As Exception
            ' MsgBox("Error: " & exc.Message)
            Send_Genlicense_System_email("Error: " & exc.Message)

        Finally

            'If Not dr Is Nothing Then dr.Close()
            If Not objdatareader Is Nothing Then

                objdatareader.Close()

            End If

            If Not objdatareader1 Is Nothing Then

                objdatareader1.Close()
            End If


            If Not objdatareader2 Is Nothing Then

                objdatareader2.Close()

            End If

            If Not objdatareader3 Is Nothing Then

                objdatareader3.Close()
            End If


            If Not objdatareader4 Is Nothing Then

                objdatareader4.Close()


            End If




            If Not objConn Is Nothing Then
                objConn.Close()
            End If

            If Not objConn1 Is Nothing Then
                objConn1.Close()
            End If

            If Not objConn2 Is Nothing Then
                objConn2.Close()
            End If



            Me.Close()

        End Try

    End Sub
 

Shezad AhmedAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David ToddSenior DBACommented:
Hi,

Make sure that an operator is set up in SQL Agent to get these alerts as well.

Check the SQL error log. In Enterprise Manager, DatabaseServerName | Management | SQL Server Logs

It is likely that this is a disk full, or database full or log full - very likely to be tempdb log file because rebooting will recreate an tempdb log file(s).

Your code appears to be properly closing your database connections after they are used.

What I'm saying above is first we need to find out more about your error.

Cheers
  David
0
Shezad AhmedAuthor Commented:
Hi David

Thanks for reply.

I have checked log and the error below occurs hell of a lot.
Date            1/29/2008 1:52:11 AM
Log            SQL Server (Archive #1 - 2/1/2008 4:52:00 PM)

Source            Logon

Message
Login failed for user 'sa'. [CLIENT: 91.121.66.99]

Also I get this message:    Date            2/1/2008 4:48:14 PM
Log            SQL Server (Archive #1 - 2/1/2008 4:52:00 PM)

Source            spid52

Message
There is insufficient system memory to run this query.


I have just over 1000000 records in error log file. Most of them are the SA login failure. Is that right, Is this what  is writing to the temp.db.

Cheers
Shezad
0
Anthony PerkinsCommented:
You don't by any chance have your SQL Server outside the firewall do you? Please say no.
0
David ToddSenior DBACommented:
Hi,

To expand on what AC is saying: It looks like your SQL Server is outside your firewall, running on a default instance instead of a named instance, and someone is trying to hack into SQL - hence the SA login messages. Maybe not tempdb filling up the drive, but rather the error logs doing so. Rebooting will cause SQL to restart and cycle the error log, and so recover some disk space.

Things to do:
Make sure that there is some sort of firewall between the internet and your SQL server.
Get a job to run sp_cycle_errorlog once a day, which will keep the size of the file down.
Investigate how to reduce the number of error-logs that SQL holds. iirc it is 6.

HTH
  David
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shezad AhmedAuthor Commented:
Thanks. I showed the IT manager the error log and he is looking into it. In a way I am glad. I thought it was my code.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.