Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Services fail to connect to SQLE on startup

Author  Topic 

asniksch
Starting Member

3 Posts

Posted - 2006-03-06 : 10:21:50

I have an application that runs as a windows service that uses an ODBC connection. I recently upgraded
the database from MSDE -> Sql Express.

Everything works fine (connectivity, etc) when I start my application manually. When I attempt to start as
a service I get connection timeouts. After a small window of time, I can rerun my service and things connect
just fine.

As a workaround I'm planning on having my service connect, fail, slep 5 seconds and then attempt a 2nd connection.
I really hate to do this and was wondering if anyone had any ideas. Below is the error log I get after I reboot
my PC.

I'm attempting to connect as: "TestMachineName\LocalServerUserNameHERE" to the DB of "MyDatabase". (Names have been
changed so I don't catch flack from my company for posting specific details :))

Connection is done via ODBC via a system DSN to "localhost". I can sucessfully test connect here, but I can only
do this after the services have all started.

Any ideas?

Thanks,

Andy


========================================================================================
========================================================================================
Error log after startup
========================================================================================
========================================================================================

2006-07-06 08:09:39.00 Server Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

2006-07-06 08:09:39.00 Server (c) 2005 Microsoft Corporation.
2006-07-06 08:09:39.00 Server All rights reserved.
2006-07-06 08:09:39.00 Server Server process ID is 460.
2006-07-06 08:09:39.00 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'.
2006-07-06 08:09:39.00 Server This instance of SQL Server last reported using a process ID of 3188 at 7/6/2006 8:08:04 AM (local) 7/6/2006 12:08:04 PM (UTC). This is an informational message only; no user action is required.
2006-07-06 08:09:39.00 Server Registry startup parameters:
2006-07-06 08:09:39.00 Server -d C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf
2006-07-06 08:09:39.00 Server -e C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG
2006-07-06 08:09:39.00 Server -l C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
2006-07-06 08:09:39.09 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2006-07-06 08:09:39.09 Server Detected 1 CPUs. This is an informational message; no user action is required.
2006-07-06 08:09:39.34 Server Using dynamic lock allocation. Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node. This is an informational message only. No user action is required.
2006-07-06 08:09:39.35 Server Database Mirroring Transport is disabled in the endpoint configuration.
2006-07-06 08:09:39.37 spid5s Starting up database 'master'.
2006-07-06 08:09:39.79 spid5s Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2006-07-06 08:09:40.09 spid5s SQL Trace ID 1 was started by login "sa".
2006-07-06 08:09:40.29 spid5s Starting up database 'mssqlsystemresource'.
2006-07-06 08:09:41.17 spid8s Starting up database 'model'.
2006-07-06 08:09:41.17 spid5s Server name is 'TestMachineName'. This is an informational message only. No user action is required.
2006-07-06 08:09:41.18 spid5s Starting up database 'msdb'.
2006-07-06 08:09:41.48 Server A self-generated certificate was successfully loaded for encryption.
2006-07-06 08:09:41.48 Server Server is listening on [ 'any' <ipv6> 1433].
2006-07-06 08:09:41.50 Server Server is listening on [ 'any' <ipv4> 1433].
2006-07-06 08:09:41.50 Server Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
2006-07-06 08:09:41.50 Server Server local connection provider is ready to accept connection on [ \\.\pipe\sql\query ].
2006-07-06 08:09:41.50 Server Dedicated administrator connection support was not started because it is not available on this edition of SQL Server. This is an informational message only. No user action is required.
2006-07-06 08:09:41.51 Server The SQL Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
2006-07-06 08:09:41.51 Server SQL Server is now ready for client connections. This is an informational message; no user action is required.
2006-07-06 08:09:42.29 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:42.29 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:42.29 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:42.29 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: 192.168.1.31]
2006-07-06 08:09:43.48 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:43.48 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:43.48 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:43.48 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:43.89 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:43.89 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:44.00 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:44.00 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:44.15 spid8s Clearing tempdb database.
2006-07-06 08:09:44.21 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:44.21 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:44.25 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:44.25 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:44.96 Logon Error: 18456, Severity: 14, State: 16.
2006-07-06 08:09:44.96 Logon Login failed for user 'TestMachineName\LocalServerUserNameHERE'. [CLIENT: <local machine>]
2006-07-06 08:09:44.96 spid8s Starting up database 'tempdb'.
2006-07-06 08:09:45.32 spid5s Recovery is complete. This is an informational message only. No user action is required.
2006-07-06 08:09:45.32 spid11s The Service Broker protocol transport is disabled or not configured.
2006-07-06 08:09:45.32 spid11s The Database Mirroring protocol transport is disabled or not configured.
2006-07-06 08:09:45.46 spid11s Service Broker manager has started.
2006-07-06 08:09:46.00 spid51 Starting up database 'MyDatabase'.
2006-07-06 08:09:46.10 spid51 Recovery is writing a checkpoint in database 'MyDatabase' (6). This is an informational message only. No user action is required.

asniksch
Starting Member

3 Posts

Posted - 2006-03-08 : 14:38:08
For what this is worth, I found a hack to get me past this. Solution involves:

1) Making your service dependant on SQL Server (this is a given, but I didn't think of it right off)
2) Attempting a reconnect after about 10 second if you fail on startup.

I'm not terribly happy wiht this solution as I don't have a full understanding of the cause, but it gets me out of the fire to find a solution. Actually I'd recommend attempting a reconnect at 2, 5, and 10 seconds after failure. From the screwing around I did to figure this out, it looks like after the 1st failed attempt you'll be let in, but who knows if I'm just getting lucky in missing whatever window of error I initially hit.

I would recommend that you make sure the connection isn't timing out however, otherwise you'll be waiting 2+timeout + 5+timeout + 10 + timeout to report back there is a problem - uncool! :)
Go to Top of Page

activecrypt
Posting Yak Master

165 Posts

Posted - 2006-03-08 : 22:17:55
Hi,
refer following discussions :

http://search.microsoft.com/results.aspx?mkt=en-US&setlang=en-US&q=SQL+Server+service+Error%3a+0x54b

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=20893&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=76142&SiteID=1

Andy Davis
Sql Shield Team
--------------------------------------------
SQL Server Encryption Software
http://www.sql-shield.com
Go to Top of Page

asniksch
Starting Member

3 Posts

Posted - 2006-03-09 : 08:14:56
Thanks for the reply.

Those articles all talk about how failure to register an SPN is "nothing to worry about" if you aren't concerned about using Kerberos - I'm not (actually I can't because the target computer won't be in a domain).

What my problem was is that when this error appears my ODBC connection balks for around 10 seconds, so I did need to worry about it. I was hopeful there would be some nugget of information floating around other there of "oh yeah, just flip these settings to ____ and the problem goes away". There hasn't been that. The solution I currently have working involves trying multiple times on a connection attempt, which isn't ideal because if the server really isn't there I increase my timeout.

If anyone knows how to make SQL 2005 not drop connections for the first ~10 seconds I'd love to hear it.

Thanks,

Andy
Go to Top of Page

keti
Starting Member

1 Post

Posted - 2006-10-02 : 14:59:09
I have the same problem. Have you found any solution yet? Thanks.
Go to Top of Page
   

- Advertisement -