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 2000 Forums
 SQL Server Administration (2000)
 Login failed

Author  Topic 

sutton
Starting Member

5 Posts

Posted - 2009-09-11 : 22:30:57
I have created an application called APP1 that is running on a logged user account CLIENT1. On that same user account, there is an application called APP2 that is working with a Microsoft SQL database called APP2_DB and I wish to have my application APP1 to do some query on APP2_DB.

The problem is that when my application APP1 tries to access the APP2_DB while APP2 is running, I get a message “Cannot open database ‘APP2_DB’ requested by the login. The login failed. Login failed for user ‘TEST123\CLIENT1’.

If I log off from user account CLIENT1 and log in as ADMINISTRATOR and run my application APP1, I can access the APP2_DB. Logged as ADMINISTRATOR, the application APP2 is not running but the system components that are part of APP2 are still listed in the dependencies of the SQL Server service and I can see those system components in the processes. The same connection string is used in my application in both accounts and all of those applications are running on the same PC so no remote connection here.

My application has been done in Visual Basic, with Visual Studio 2008.
The connection string that I’m using is “server=127.0.0.1,2025; AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL\Data\APP1_DB.MDF; uid=CLIENT1;pwd=******;Integrated Security=True; Connect Timeout=30;User Instance=True"

In that connection string, I know the server port is good because it works under ADMINISTRATOR account and I can see the same port number with the SQL Server log file and in the registry.
In that connection string, I know the path and file name of AttachDbFilename is good as it works under ADMINISTRATOR account.
In that connection string, I know the uid and pwd are good because I have seen them in a table of APP2_DB. I have been able to see the content of APP2_DB by making a copy of the APP2_DB on the separate PC.

When logged as ADMINISTRATOR,I have run the tool svrnetcn.exe and I have tried to add a TCP port to the existing port 2025. When doing this, the application APP2 doesn’t like this and stop working. I was not able to try to add a alias because there is no alias tab in the tool svrnetcn.exe

The PC is a Microsoft Windows 2000 Professional, Version 5.0.2195 Service Pack 4 Build 2195

The PC has the following Services running
MSSQLSERVER Running Auto Own Process
MSSQLServerADHelper Stopped Manual Own Process
SQLSERVERAGENT Running Auto Own Process

The log file of Microsoft SQL shows the following information:
Microsoft SQL Server 2000 - 8.00.384 (Intel X86)
Desktop Engine on Windows NT 5.0 (Build 2195: Service Pack 4)
SQL Server configured for thread mode processing.
Using dynamic lock allocation. [500] Lock Blocks, [1000] Lock Owner Blocks.
Using 'SSNETLIB.DLL' version '8.0.382'.
Server name is 'TEST123'.
SQL server listening on 192.168.1.103: 2025.
SQL server listening on 127.0.0.1: 2025.
SQL server listening on TCP, Shared Memory, Named Pipes.
SQL Server is ready for client connections
Starting up database 'APP1_DB'.

Since I don’t want to screw up the APP2 for which I’m not the one who has done it, and I don’t want to screw up the PC running at my customer site, I’m very careful to make some upgrade to the Windows and SQL server version.

There must be something, somewhere, that makes the APP2 to lock the APP2_DB but I don’t know how to unlock this. I have gone to several days of looking at forums and trying different things without any success. If someone as trick to unlock the DB, I would appreciate to know it.

Thanks in advance for your advice.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-09-12 : 00:52:19
Login failed just means that the login is incorrect (login specified doesn't have access) or the password provided is incorrect for the login.

Let's start simple:
Your connection string is not correct. You can't specify integrated security and then also provide uid/pwd. Check out www.connectionstrings.com for valid ones.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sutton
Starting Member

5 Posts

Posted - 2009-09-12 : 22:22:13
Unfortunally, none of the suggested connection strings from www.connectionstrings.com works. I probably have tried all possible combinations of connection string, which let me think that the problem is not the connection string itself but some other setting.

By the way, the MSSQLServer registry LoginMode is set to 0, which is the mix mode so it should allow me to login with more different ways.

Is it possible that the running application APP2 is limiting the number of connection to the APP2_DB with some procedure? I'll search for a command like that but if someone knows the answer, that would help me.
Go to Top of Page

sutton
Starting Member

5 Posts

Posted - 2009-09-13 : 14:49:07
One additional observation, when logged as administrator, I can see in the log of MSSQLServer that the database APP2_DB has been started. The SQL services related to the APP2 are running but not the application APP2 itself. I can also do a osql -S 127.0.0.1,2025 -d APP2_DB -E and then do queries.

If I loggin as CLIENT1 and call the same osql, I get the login failed.

Any advice on this?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-09-13 : 23:26:56
Has CLIENT1 been added to the SQL Server and been provided access?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sutton
Starting Member

5 Posts

Posted - 2009-09-14 : 10:53:54
I found a workaround. I have logged as administrator and in the control panel/user account, I added the user CLIENT1 as part of the group administrators. From that point, the osql query have worked.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-09-14 : 13:16:06
This is not a recommended approach as CLIENT1 now has sysadmin to SQL Server. This is very dangerous. You should instead add the account to SQL Server and provide the minimum amount of permissions that are needed.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

sutton
Starting Member

5 Posts

Posted - 2009-09-14 : 15:08:39
Tara, you are absolutely right about the risk of my move. I will look into your suggestion going forward.

Thanks
Go to Top of Page
   

- Advertisement -