Showing posts with label ado. Show all posts
Showing posts with label ado. Show all posts

Wednesday, March 28, 2012

long running queries quit - audit logout

I have a web based application that launches sql queries using ADO from
ASP/VBScript. Typically 2 - 10 queries are executed in a loop, and the
result sets are sent off to Crystal Reports at the end of the run with the
report being displayed in a browser window. In general this all works well
is has been very reliable.
Lately I've been having trouble with some of these queries on databases that
have gotten quite large (25 - 40G) but only a couple of the tables have
rowcounts in the tens of millions, most are relatively small. The behavior
is that the first query runs, sometimes for up to 90 minutes, seems to
complete, and then the pid is gone. Looking at the profile trace, I can see
that the query executed nearly 13 M reads with a duration of over 90
minutes. The line following the SQL:BatchCompleted event is Audit Logout,
and thats the last trace of the process. Under "normal" operation, the next
query would start and they would all run until the loop is complete. I've
seen this now with 2 completely different sets of queries, on 2 different
dbs, yet the symptoms are the same. It completes a very simple query that
returns a single datetime value. Then the first "real" query runs, anywhere
from 60 - 90 minutes or more, and then the process goes away.
It seems as if I've reached some threshold or internal timeout. I have the
connection time and query timeouts set to very large values (1000 minutes),
so it's not that.The client process is of course IIS. This is running SQL
Server 2000 SP3, NT 4.0, IIS 5.5.
I have had sets of queries that have taken as long as 3 hours to complete,
but each individual query probably never exceeded 45 minutes in duration.
Can anyone think of what is causing this to happen -- why does the pid go
away after the first query completes? Is there some other internal timeout
somewhere that I'm running into?
Any advice is appreciated,
-GaryYou might be experiencing lock_timeout. See if it helps:
http://msdn.microsoft.com/library/en-us/tsqlref/ts_set-set_1yr8.asp
"Gary" <gld@.hotmail.com> wrote in message
news:bisSc.243431$IQ4.52808@.attbi_s02...
> I have a web based application that launches sql queries using ADO from
> ASP/VBScript. Typically 2 - 10 queries are executed in a loop, and the
> result sets are sent off to Crystal Reports at the end of the run with the
> report being displayed in a browser window. In general this all works well
> is has been very reliable.
> Lately I've been having trouble with some of these queries on databases
that
> have gotten quite large (25 - 40G) but only a couple of the tables have
> rowcounts in the tens of millions, most are relatively small. The behavior
> is that the first query runs, sometimes for up to 90 minutes, seems to
> complete, and then the pid is gone. Looking at the profile trace, I can
see
> that the query executed nearly 13 M reads with a duration of over 90
> minutes. The line following the SQL:BatchCompleted event is Audit Logout,
> and thats the last trace of the process. Under "normal" operation, the
next
> query would start and they would all run until the loop is complete. I've
> seen this now with 2 completely different sets of queries, on 2 different
> dbs, yet the symptoms are the same. It completes a very simple query that
> returns a single datetime value. Then the first "real" query runs,
anywhere
> from 60 - 90 minutes or more, and then the process goes away.
> It seems as if I've reached some threshold or internal timeout. I have the
> connection time and query timeouts set to very large values (1000
minutes),
> so it's not that.The client process is of course IIS. This is running SQL
> Server 2000 SP3, NT 4.0, IIS 5.5.
> I have had sets of queries that have taken as long as 3 hours to complete,
> but each individual query probably never exceeded 45 minutes in duration.
> Can anyone think of what is causing this to happen -- why does the pid go
> away after the first query completes? Is there some other internal timeout
> somewhere that I'm running into?
> Any advice is appreciated,
> -Gary
>
>|||Thanks for the tip. I checked a server and it's returning -1 (infinite) for
this. I'm thinking that the problem is the client connection to the database
dropping sometime during the processing of a query, and when the statement
complete event occurs, SQL detects that the connection is gone and therefore
the audit logoff event.
"oj" <nospam_ojngo@.home.com> wrote in message
news:O7lkZQ$fEHA.3632@.TK2MSFTNGP09.phx.gbl...
> You might be experiencing lock_timeout. See if it helps:
> http://msdn.microsoft.com/library/en-us/tsqlref/ts_set-set_1yr8.asp
>

Monday, March 19, 2012

Logon Failed

Hi!

Please check out my code. I get this error when I 'CRViewer.ViewReport' is called.

Logon failed.
Details: ADO Error Code: 0x80030020
Source: MS OLE DB Service Components
Description: A share violation has occured

The code is pretty simple and basic. Is there anything missing or something I didn't declare?

Thanks a lot!

--------------------

Dim crxApp As New CRAXDRT.Application
Dim crxRep As CRAXDRT.Report
Dim crxDBTable As CRAXDRT.DatabaseTable
Dim crxDB As CRAXDRT.Database
Dim crxConn As CRAXDRT.ConnectionProperty

On Error GoTo ERROR_HANDLER

DoEvents
Screen.MousePointer = vbHourglass

Do
DoEvents

If CBox.GetPrinterJobs(TReport.DeviceName) <= 2 Then
Exit Do
End If
Loop

Select Case UCase(TReport.reportName)
Case "PASTDUE_SCHEDULE"
strFilename = "PDOSchedule"

Case "PASTDUE_CURRENT"
strFilename = "PDOCurrent"

Case "PASTDUE_30DAYS"
strFilename = "PDO30Days"

Case "PASTDUE_ACTIVE"
strFilename = "PDOActive"

Case "PASTDUE_SUSPENDED"
strFilename = "PDOSuspended"

Case "PASTDUE_CANCELLED"
strFilename = "PDOCancelled"

Case "PASTDUE_ABC"
strFilename = "PDOABCEmployees"

End Select

' Open crystal report printjob and get number of parameters
strFilename = UCase(App.Path & "\Reports\" & strFilename & ".rpt")
strMessage = TPastDue.Message

' Open the report
Set crxRep = crxApp.OpenReport(strFilename)

' Set database location
Set crxDBTable = crxRep.Database.Tables(1)
crxDBTable.Location = CBox.IniFileRead("Database", "Name")

' Pass parameters to report
With crxRep.ParameterFields
For i = 1 To .Count
For j = 0 To .Count - 1
If Trim(UCase(.Item(i).parameterFieldName)) = Trim(UCase(TReport.Parameters(j, 0))) Then
.Item(i).AddCurrentValue TReport.Parameters(j, 1)
Exit For
End If
Next
Next
End With

' Set printer settings
With TReport
crxRep.SelectPrinter .DriverName, .DeviceName, .Port
End With

' Set selection formula
If TReport.Filter <> "" Then
crxRep.RecordSelectionFormula = TReport.Filter
End If

Screen.MousePointer = vbDefault

With frmReportPreview.CRViewer
.ReportSource = crxRep
.ViewReport
End WithDear Questioner, Please use logon properties.

Dim Application As New CRAXDRT.Application

Dim report As CRAXDRT.report

Dim tbl As CRAXDRT.DatabaseTable
Set report = Application.OpenReport("E:\NAD\rptItemSearch.rpt")

Set tbl = report.Database.Tables(1)

tbl.ConnectionProperties("Data Source") = "SQLSERVER"
tbl.ConnectionProperties("Initial Catalog") = "Hilbro"
tbl.ConnectionProperties("User ID") = "Wajid"
tbl.ConnectionProperties("Password") = "WSBis#1"

frmItemReport.CRViewer.ReportSource = report

frmItemReport.CRViewer.ViewReport

frmItemReport.Show

I hope this will help.