Re: Login failure...

From: Rob R. Ainscough (robains_at_pacbell.net)
Date: 02/01/05


Date: Tue, 1 Feb 2005 08:59:20 -0800

I do write to the EventLog, and I can see the error message in the event
log -- that's where it suggests "Login failure..." and even tells me the
function, I add variable info to the EventLog and all is good. But like I
said, if I run the same code in debug mode (stepping thru the code), I don't
get any errors.

So, I'm thinking this is a timing problem with connections to the my SQL
Server, I can connect and disconnect rapidly in succession (usually in a
loop) -- I'm suspecting the connection overhead with rapid
connects/disconnects is the cause -- this is the ONLY thing I can come up
with as it obviously appears to be a timing issue. Also, the fact that the
same code going against a local SQL Server on my same PC does NOT produce
any errors (debug or just running the code) would also point towards
connection/disconnect timing problem (i.e. my remote SQL Server can't keep
up or something).

Does the SQL Server produce any events that I could check to see what
problems it maybe reporting?

I'm going to try to code my connection processing differently and see if
this resolves it.

Rob.

"Extreme Datasets" <ExtremeDatasets@discussions.microsoft.com> wrote in
message news:BCECDE6C-4D2F-469F-860F-E308784BEFA3@microsoft.com...
> Hello Rob,
>
> Check out the code below and in your appilcation make sure your suspect
> code
> is in a Try, Catch block. You Should Be able to Copy and Paste, let me
> know
> if this helps
> '**********************************************************
> '** Example For Your Code
> '**********************************************************
> Private Sub MyMethod
> Try
>
> Catch ex As Exception
> WriteToErrorLog("MyMethod", ex.Message & vbCrlf & vbCrlf &
> ex.StackTrace
> End Try
> End Sub
> '**********************************************************
> '** This Function Get The AppPath(Not The Bin, but the Project Folder)
> '**********************************************************
> Public Shared Function GetAppPath() As String
> If Not Right(Microsoft.VisualBasic.CurDir.Replace("bin", ""), 1) =
> "\" Then
> Return Microsoft.VisualBasic.CurDir.Replace("bin", "") & "\"
> Else
> Return Microsoft.VisualBasic.CurDir.Replace("bin", "")
> End If
> End Function
>
> '**********************************************************
> '** This Method Will Write Any Errors To The ErrorLog Folder In Your
> Project
> Folder
> '**********************************************************
> Public Shared Sub WriteToErrorLog(ByVal Sender As String, ByVal Message As
> String)
>
> Try
> Dim FilePath As String = GetAppPath() & "ErrorLog\ErrorLog" &
> Microsoft.VisualBasic.DateAndTime.Month(Now).ToString &
> Microsoft.VisualBasic.DateAndTime.Day(Now).ToString & Year(Now).ToString &
> ".txt"
> Dim SWriter As System.IO.StreamWriter
>
> If System.IO.Directory.Exists(GetAppPath() & "ErrorLog") =
> False
> Then System.IO.Directory.CreateDirectory(GetAppPath() & "ErrorLog")
>
> If System.IO.File.Exists(FilePath) = False Then
>
> SWriter = System.IO.File.CreateText(FilePath)
>
>
> SWriter.WriteLine("*****************************************")
>
> SWriter.WriteLine("** SENDER: " & Sender)
>
> SWriter.WriteLine("** ERROR: " & Message)
>
>
> SWriter.WriteLine("*****************************************")
>
> SWriter.Flush()
>
> SWriter.Close()
>
> Else
>
> SWriter = System.IO.File.AppendText(FilePath)
>
>
> SWriter.WriteLine("*****************************************")
>
> SWriter.WriteLine("** SENDER: " & Sender)
>
> SWriter.WriteLine("** ERROR: " & Message)
>
>
> SWriter.WriteLine("*****************************************")
>
> SWriter.Flush()
>
> SWriter.Close()
>
> End If
>
> Catch ex As Exception
>
> MsgBox("There was a problem writing to the Error Log." & vbCrLf
> & vbCrLf & "Please report this to World Touch Interactive.",
> MsgBoxStyle.Exclamation, "Error Writing To File")
> Application.Exit()
>
> End Try
> End Sub
>
>
> "Rob R. Ainscough" wrote:
>
>> I ran my code against my LOCAL SQL Server database -- all works.
>>
>> I run the code against a remote SQL Server providing the correct uid and
>> password, and I get Login failure. What is more bizarre, if I step thru
>> the
>> code in VS.NET (exact same code with same connection values), I don't get
>> the error??
>>
>> If I exit VS.NET and run the .EXE (managed) by itself, I get the error?
>>
>> I'm at a total loss, I don't even know where to turn to try and debug (as
>> everything works when I debug) -- any suggestions?
>>
>> Rob.
>>
>>
>>



Relevant Pages

  • Login Seems OK but doesnt behave correctly
    ... Using MS SQL server on a shared host (www.joglab.com shows the ... login but not behaving on the pages ie LoginView/ Login Status not ... Web Site Administration Tool I get "Could not establish a connection ... <LoggedInTemplate> ...
    (comp.databases.ms-sqlserver)
  • Re: forms authentction against sql server 2000
    ... Try using Query Analyzer using the same login and see. ... I'm using sql server 2000 on a remote machine and I have a login.aspx page ... "An error has occurred while establishing a connection to the server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Whats the best way to open a Connection to DB in the WEB envoironment
    ... applied an ideal logic to open a connection from my application. ... Backend Database: SQL Server 2000. ... I have created "Login" for each users in SQL Server 2000 and all of them ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Remote connection failed
    ... create new username/password login with SQL Server ... Select Authentication = SQL Server and Windows on Security tab of SQL ... Connection string in SQLDriverConnect string is "Driver=; ...
    (microsoft.public.sqlserver.connect)
  • Re: Permissions!
    ... You can grant object permissions to this login and control ... Sub ExecuteQueryForUser(UserId, TableName) ... Set connection = Nothing ...
    (microsoft.public.sqlserver.security)