Showing posts with label login. Show all posts
Showing posts with label login. Show all posts

Monday, March 19, 2012

Connection Management

Hi:

I have a Point-of-sale application that uses SQL Server2000 for the backend.
Basically, the users perform various functions boiling down to login (check
password from a table) and data entry (insert a food entry). Previously, I
would open a new ADO 2.7 connection to the database each time one of these
types of database accessing functions needed to be performed - but I noticed
that sometimes the DB would freeze the application for 20 seconds or so - or
even cause a timeout error.

To fix this, I open a DB connection when the application first starts,
keeping it open for the life of the application - each time a function needs
to access the DB, it just uses the applications (global) connection that is
constantly open and connected.

This seems to have fixed the problem, however, I am curious, is this an OK
way to handle the connections - keeping in mind that there are four separate
stations - each running the application - at the same time. Therefore, I
have 4 constantly open connections at the same time.

Thanks and regards,

Ryan Kennedy"Ryan P. Kennedy" <ryanp.kennedy@.verizon.net> wrote in message
news:lYnBb.4549$UM4.1037@.nwrdny01.gnilink.net...
> Hi:
> I have a Point-of-sale application that uses SQL Server2000 for the
backend.
> Basically, the users perform various functions boiling down to login
(check
> password from a table) and data entry (insert a food entry). Previously,
I
> would open a new ADO 2.7 connection to the database each time one of these
> types of database accessing functions needed to be performed - but I
noticed
> that sometimes the DB would freeze the application for 20 seconds or so -
or
> even cause a timeout error.
> To fix this, I open a DB connection when the application first starts,
> keeping it open for the life of the application - each time a function
needs
> to access the DB, it just uses the applications (global) connection that
is
> constantly open and connected.
> This seems to have fixed the problem, however, I am curious, is this an OK
> way to handle the connections - keeping in mind that there are four
separate
> stations - each running the application - at the same time. Therefore, I
> have 4 constantly open connections at the same time.
>
> Thanks and regards,
> Ryan Kennedy

I don't know much about ADO, but it sounds like you're describing a form of
connection pooling, which is certainly a very common way to manage
connections from multiple clients.

Simon|||"Ryan P. Kennedy" <ryanp.kennedy@.verizon.net> wrote in message
news:lYnBb.4549$UM4.1037@.nwrdny01.gnilink.net...
> Hi:
> I have a Point-of-sale application that uses SQL Server2000 for the
backend.
> Basically, the users perform various functions boiling down to login
(check
> password from a table) and data entry (insert a food entry). Previously,
I
> would open a new ADO 2.7 connection to the database each time one of these
> types of database accessing functions needed to be performed - but I
noticed
> that sometimes the DB would freeze the application for 20 seconds or so -
or
> even cause a timeout error.
> To fix this, I open a DB connection when the application first starts,
> keeping it open for the life of the application - each time a function
needs
> to access the DB, it just uses the applications (global) connection that
is
> constantly open and connected.
> This seems to have fixed the problem, however, I am curious, is this an OK
> way to handle the connections - keeping in mind that there are four
separate
> stations - each running the application - at the same time. Therefore, I
> have 4 constantly open connections at the same time.

Connection pooling, the sharing of a single connection among components of
an application, is very common and a good design principle. It is
particularly great for web based/ASP applications, in order to conserve
resource. Persistant connections, keeping a connection open even when not in
use, is something I shy away from in my client server and my web based app
designs. I prefer to create a connection, pool it, and then open and close
it as needed.

It sounds like you are looking for a solution to a symptom, and not your
problem. If I were you, I would investigate the reason your app is timing
out and solve that.

--
BV.
WebPorgmaster - www.IHeartMyPond.com
Work at Home, Save the Environment - www.amothersdream.com

Sunday, March 11, 2012

Connection information in a table trigger?

Is it possible to log or insert into a table the connection information (Application & Login) from an table trigger?

We have tough problem where data in a particular table is getting 'wiped-out' (rows are getting set to all NULLs) and we are unable to correlate this with any particular piece of software. My hope is that we can write an table trigger that can log or create an row in a temp table or the like to allow us to track this down to the offending application so that we can finallly get rid of the problem entirely.

Thanks,

You really should be using Profiler for this kind of activity. It will be able to give you more information than a TRIGGER. Profiler will allow you to capture the entire query (or queries) that are being sent to the server.

A TRIGGER would only allow you to log parameter and system values -NOT the actual query.

|||

Agree with Arnie for the most part, you can use profiler for this most likely. You would want to get really granular and track statements inside procedures too. You might also filter on the name of the table. Profiler can be kind of noisy/picky, so it might take a few tries, but it is the greatest thing to have in a crisis Smile

As far as a trigger, you can get some of this information from sys.sysprocesses (or master.dbo.sysprocesses for 2000 and earlier.) You could join some of the values with the values in the inserted and deleted tables to see what is happening at a granular way. What I might do is to add a trigger that does:

if exists (select * from inserted where columnIDon'tWantSetToNull is null)

begin

raiserror ('DON''T DO THIS!',16,1)

rollback transaction

end

insert into log

select inserted.key, sysprocesses.columns
from inserted
join sysprocesses

on sysprocesses.spid = @.@.spid

If the operation was not in a transaction, you will get a log row, but your data will certainly not be hosed. If your application/process doesn't just ignore errors, you can track it down that way.

|||

Thank you both for your help. I'm not very good/handy with profiler, but I'll give it a try if I don't get anywhere with it, I'll try with an trigger on the table and the sysprocess table information.

George

|||

You definitely need to get good with profiler. In my opinion, it is the greatest thing about SQL Server, and for a person who has worked only with SQL Server for 15 years, that is saying something. Diagnosing problems with SQL Server is so much easier than pretty much any other programming tool, simply because I can see, immediately what the "heathen" user is trying to do to it and stop them.

Of course it has made it easy to simply force the DBA to prove that the database is not the culprit first since it is so easy, but that is another story Smile

|||

How do I see the parameter values sent in a parameterized query in Profiler?

George

|||Profiler will show you the entire query, with parameters placed in the correct locations.

Thursday, March 8, 2012

connection failed: SQLstate: 28000

I have SQL 2000 installed in my windows 2003 server with mixed mode authentication. When I login to the server and open the SQL server manager under my windows name everything works. And if I try to create an odbc connection from one of the client pc's or from the server itself using windows authentication still everything works. Now I opened the SQL enterprise manager and in the Security section, there is a user group called BUILTIN\Administrators, I was asked to deny access to this group in SQL. So I did that and added my windows login name in the security -> Login section. Now still if I try to open the enterprise manager and and login to sql under my windows login name it works. But if I try to create an odbc connection to the sql server either from the server itself or from the client work station I get the following error:

connection failed:
SQLstate: '28000'
SQL Server Error: 18456
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'PROD\pchelin'

If I go to the security -> Login and enable BUILT\Aministrators group, everything works. But I would like to know how to disable that group and add my own windows group or login id in SQL server and connect using ODBC.

Your valuable feedback is greatly appriciated.

Hi,

I do not know which user you use to connect to SQL server except your login, and I have no idea if you are a member of built\Administrators group, but I know that if you deny Access to server for group even if user itself had rights to access server this DENY will prevent user to log into SQL Server.

I hope that it helps

JPazgier

|||

You are correct. The moment I deleted the BUILT/Administrators group it started to work. Are there any disadvantages in deleting this group?

|||

If it was windows group it is not safe to delete it. It will be good practice to create another group like SQLAdministrators and give its users rights to be admins on SQL server. The only problem can be that administrators have by default rights to SQL server so you have to just remove this rights to SQL server but do not set Deny access.

JPazgier

Saturday, February 25, 2012

Connection Error 18452 - Login failed for user '(null)'

Hello everybody,
one of our users gets an error message when trying to connect to our SQL
Server database:
Connection failed:
SQLState: '28000'
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.
The problem occured suddenly during work. The user can connect to the server
using another computer and other users can connect using his computer.
Knowledge base didn't help so I'm asking you.
Configuration
Client: Windows XP professional (2002/SP1)
ODBC driver: SQL Server (2000.81.9042.00)
Client configuration: TCP/IP
Server: Windows 2000 Server
SQL Server 7.0
Seems the network setup for the user is somehow corrupted, since the message
states the user to be '(null)'.
Any suggestions?
Thanks in advance,
Markus Wolff
This is always an authentication problem somewhere. The null indicates that
user cannot be validated and a null is being passsed to SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.
|||Rand, what about a solution or al least pointing to one?
"Rand Boyd [MSFT]" wrote:

> This is always an authentication problem somewhere. The null indicates that
> user cannot be validated and a null is being passsed to SQL Server.
> Rand
> This posting is provided "as is" with no warranties and confers no rights.
>
|||It really depends on where the process is failing. You would
want to check the event logs on the PC having the problems
connecting. Check for any network related issues or
problems. Make sure that PC is contacting the domain
controllers without any problems and that they are
successfully logging into the network.
-Sue
On Mon, 13 Dec 2004 08:25:02 -0800, "JC"
<JC@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Rand, what about a solution or al least pointing to one?
>"Rand Boyd [MSFT]" wrote:
|||Login failed for user <null> usually means that on the SQL box, the user
account could not be found in the local security database or in the domain
controller's user database.
For example, on machine1 I log in as machine1\user1. Then I try to log into
SQL on machine2. On machine2 SQL takes the SID of the user and calls
LookupAccountSID API. This attempts to convert the SID to the user name.
LookupAccountSID first looks in local security database on machine2, and
does not find machine1\User1, then looks on domain controller, and still
does not find the SID.
So in general this points to problems with the user account. Perhaps the
user has the same account name defined on their local machine and when they
log in they don't realize that they are logging in as the local User1 versus
the domain User1. Go to the problematic machine and check the user
accounts. If this does not work, perhaps have the domain admin drop the
user account and recreate it.
Matt
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:jd4sr0ds5vna1pc5ph4ri66j5hmri6d51p@.4ax.com...
> It really depends on where the process is failing. You would
> want to check the event logs on the PC having the problems
> connecting. Check for any network related issues or
> problems. Make sure that PC is contacting the domain
> controllers without any problems and that they are
> successfully logging into the network.
> -Sue
> On Mon, 13 Dec 2004 08:25:02 -0800, "JC"
> <JC@.discussions.microsoft.com> wrote:
>

Connection Error 18452 - Login failed for user '(null)'

Hello everybody,
one of our users gets an error message when trying to connect to our SQL
Server database:
Connection failed:
SQLState: '28000'
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.
The problem occured suddenly during work. The user can connect to the server
using another computer and other users can connect using his computer.
Knowledge base didn't help so I'm asking you.
Configuration
Client: Windows XP professional (2002/SP1)
ODBC driver: SQL Server (2000.81.9042.00)
Client configuration: TCP/IP
Server: Windows 2000 Server
SQL Server 7.0
Seems the network setup for the user is somehow corrupted, since the message
states the user to be '(null)'.
Any suggestions?
Thanks in advance,
Markus WolffThis is always an authentication problem somewhere. The null indicates that
user cannot be validated and a null is being passsed to SQL Server.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Rand, what about a solution or al least pointing to one?
"Rand Boyd [MSFT]" wrote:

> This is always an authentication problem somewhere. The null indicates tha
t
> user cannot be validated and a null is being passsed to SQL Server.
> Rand
> This posting is provided "as is" with no warranties and confers no rights.
>|||It really depends on where the process is failing. You would
want to check the event logs on the PC having the problems
connecting. Check for any network related issues or
problems. Make sure that PC is contacting the domain
controllers without any problems and that they are
successfully logging into the network.
-Sue
On Mon, 13 Dec 2004 08:25:02 -0800, "JC"
<JC@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>Rand, what about a solution or al least pointing to one?
>"Rand Boyd [MSFT]" wrote:
>|||Login failed for user <null> usually means that on the SQL box, the user
account could not be found in the local security database or in the domain
controller's user database.
For example, on machine1 I log in as machine1\user1. Then I try to log into
SQL on machine2. On machine2 SQL takes the SID of the user and calls
LookupAccountSID API. This attempts to convert the SID to the user name.
LookupAccountSID first looks in local security database on machine2, and
does not find machine1\User1, then looks on domain controller, and still
does not find the SID.
So in general this points to problems with the user account. Perhaps the
user has the same account name defined on their local machine and when they
log in they don't realize that they are logging in as the local User1 versus
the domain User1. Go to the problematic machine and check the user
accounts. If this does not work, perhaps have the domain admin drop the
user account and recreate it.
Matt
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:jd4sr0ds5vna1pc5ph4ri66j5hmri6d51p@.
4ax.com...
> It really depends on where the process is failing. You would
> want to check the event logs on the PC having the problems
> connecting. Check for any network related issues or
> problems. Make sure that PC is contacting the domain
> controllers without any problems and that they are
> successfully logging into the network.
> -Sue
> On Mon, 13 Dec 2004 08:25:02 -0800, "JC"
> <JC@.discussions.microsoft.com> wrote:
>
>

Connection Error 18452 - Login failed for user '(null)'

Hello everybody,
one of our users gets an error message when trying to connect to our SQL
Server database:
Connection failed:
SQLState: '28000'
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.
The problem occured suddenly during work. The user can connect to the server
using another computer and other users can connect using his computer.
Knowledge base didn't help so I'm asking you.
Configuration
Client: Windows XP professional (2002/SP1)
ODBC driver: SQL Server (2000.81.9042.00)
Client configuration: TCP/IP
Server: Windows 2000 Server
SQL Server 7.0
Seems the network setup for the user is somehow corrupted, since the message
states the user to be '(null)'.
Any suggestions?
Thanks in advance,
Markus Wolff
I have the same problem and this is a problem associated with trusted SQL
Server connections, there is a document out there that says that if you use
named pipes everything is great but using TCP/IP, then you need to configure
Active directory and possibly using kerberos (instead of NTLM). I was hoping
to get more info on how to set out systems at work so that trusted
connections can work.
"Markus Wolff" wrote:

> Hello everybody,
> one of our users gets an error message when trying to connect to our SQL
> Server database:
> Connection failed:
> SQLState: '28000'
> SQL Server Error 18452
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
> '(null)'. Reason: Not associated with a trusted SQL Server connection.
> The problem occured suddenly during work. The user can connect to the server
> using another computer and other users can connect using his computer.
> Knowledge base didn't help so I'm asking you.
> Configuration
> Client: Windows XP professional (2002/SP1)
> ODBC driver: SQL Server (2000.81.9042.00)
> Client configuration: TCP/IP
> Server: Windows 2000 Server
> SQL Server 7.0
> Seems the network setup for the user is somehow corrupted, since the message
> states the user to be '(null)'.
> Any suggestions?
> Thanks in advance,
> Markus Wolff
>
>

Connection Error 18452 - Login failed for user '(null)'

Hello everybody,
one of our users gets an error message when trying to connect to our SQL
Server database:
Connection failed:
SQLState: '28000'
SQL Server Error 18452
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
user
'(null)'. Reason: Not associated with a trusted SQL Server connection.
The problem occured suddenly during work. The user can connect to the server
using another computer and other users can connect using his computer.
Knowledge base didn't help so I'm asking you.
Configuration
Client: Windows XP professional (2002/SP1)
ODBC driver: SQL Server (2000.81.9042.00)
Client configuration: TCP/IP
Server: Windows 2000 Server
SQL Server 7.0
Seems the network setup for the user is somehow corrupted, since the message
states the user to be '(null)'.
Any suggestions?
Thanks in advance,
Markus WolffI have the same problem and this is a problem associated with trusted SQL
Server connections, there is a document out there that says that if you use
named pipes everything is great but using TCP/IP, then you need to configure
Active directory and possibly using kerberos (instead of NTLM). I was hoping
to get more info on how to set out systems at work so that trusted
connections can work.
"Markus Wolff" wrote:

> Hello everybody,
> one of our users gets an error message when trying to connect to our SQL
> Server database:
> Connection failed:
> SQLState: '28000'
> SQL Server Error 18452
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed fo
r user
> '(null)'. Reason: Not associated with a trusted SQL Server connection.
> The problem occured suddenly during work. The user can connect to the serv
er
> using another computer and other users can connect using his computer.
> Knowledge base didn't help so I'm asking you.
> Configuration
> Client: Windows XP professional (2002/SP1)
> ODBC driver: SQL Server (2000.81.9042.00)
> Client configuration: TCP/IP
> Server: Windows 2000 Server
> SQL Server 7.0
> Seems the network setup for the user is somehow corrupted, since the messa
ge
> states the user to be '(null)'.
> Any suggestions?
> Thanks in advance,
> Markus Wolff
>
>

Connection Error

Error Message:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

The error occurs in Visual Studio 2005 v 8.0.50725.42. I have my string in my web.config file. In Visual Studio it doesn't work. When you upload the page it connects and shows the data. Now, I have been several places and been asked, "So what's the issue?" The problem is that I want Visual Studio 2005 to connect so that I can use it to create Gridviews, use the Server Explorer and so on.

Is there an upgrade to VS2005? Is this a known bug? Is there a work-around - a configuration that needs to be setup in the web.config file? I've only just begun my .NET 2.0 experience so type slow and use small words...

Thanks!

I suppouse you are talking about connection string for a database ?, I think you should try this questions in forums about general development or data access, and also give more info about how are you making the connection string, if you are using the "connectionStrings" section and so on.

This forum is only related to Team System and TFS issues, sorry.

Sunday, February 19, 2012

Connection between two domains

Hi All,
We have two different domains in our environment, say ABC and XYZ, and they
are not trusted. I login into my PC using ABC domain .
I have windows authenticated login in SQLServer that is in XYZ domain.
Can anyone tell me how I can connect to SQL server that is in different
domain using Enterprise Manager or query analyzer?
Thanks,
VinodHi,
You can try doing a Run As ...
Shift + Right Click on EM shortcut and select Run As ...
Enter your other domain user credentials in the form:
domain\username
password
I'm not 100% sure that this will work though. Is your computer a member of
both domains?
It will somehow have to authenticate your credentials with the other domain.
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and
> they
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>|||I believe that your only option is to create the same account (and same pass
word) in both domains.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and the
y
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>|||Hi Dan,
Thanks for the info. This is working. But it is failing for SQLServers
that are in ABC domain. It looks like I have to maintain two different
shortcuts for Enterprise manager one for each domain.
Thanks,
Vinod
"dan artuso" wrote:

> Hi,
> You can try doing a Run As ...
> Shift + Right Click on EM shortcut and select Run As ...
> Enter your other domain user credentials in the form:
> domain\username
> password
> I'm not 100% sure that this will work though. Is your computer a member of
> both domains?
> It will somehow have to authenticate your credentials with the other domai
n.
> --
> HTH
> Dan Artuso
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
>
>|||Hi Tibor,
I tried using the same account and same passwords in both the domains, but
that didnot work.
Thanks,
Vinod
"Tibor Karaszi" wrote:

> I believe that your only option is to create the same account (and same pa
ssword) in both domains.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
>|||Hi,
Yes, you would never be able to see servers from both domains in one
instance of EM.
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:63AA4081-792D-4267-8347-DAE6F36A5716@.microsoft.com...[vbcol=seagreen]
> Hi Dan,
> Thanks for the info. This is working. But it is failing for SQLServers
> that are in ABC domain. It looks like I have to maintain two different
> shortcuts for Enterprise manager one for each domain.
> Thanks,
> Vinod
> "dan artuso" wrote:
>

Connection between two domains

Hi All,
We have two different domains in our environment, say ABC and XYZ, and they
are not trusted. I login into my PC using ABC domain .
I have windows authenticated login in SQLServer that is in XYZ domain.
Can anyone tell me how I can connect to SQL server that is in different
domain using Enterprise Manager or query analyzer?
Thanks,
VinodHi,
You can try doing a Run As ...
Shift + Right Click on EM shortcut and select Run As ...
Enter your other domain user credentials in the form:
domain\username
password
I'm not 100% sure that this will work though. Is your computer a member of
both domains?
It will somehow have to authenticate your credentials with the other domain.
--
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and
> they
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>|||I believe that your only option is to create the same account (and same password) in both domains.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and they
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>|||Hi Dan,
Thanks for the info. This is working. But it is failing for SQLServers
that are in ABC domain. It looks like I have to maintain two different
shortcuts for Enterprise manager one for each domain.
Thanks,
Vinod
"dan artuso" wrote:
> Hi,
> You can try doing a Run As ...
> Shift + Right Click on EM shortcut and select Run As ...
> Enter your other domain user credentials in the form:
> domain\username
> password
> I'm not 100% sure that this will work though. Is your computer a member of
> both domains?
> It will somehow have to authenticate your credentials with the other domain.
> --
> HTH
> Dan Artuso
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> > Hi All,
> >
> > We have two different domains in our environment, say ABC and XYZ, and
> > they
> > are not trusted. I login into my PC using ABC domain .
> >
> > I have windows authenticated login in SQLServer that is in XYZ domain.
> >
> > Can anyone tell me how I can connect to SQL server that is in different
> > domain using Enterprise Manager or query analyzer?
> >
> > Thanks,
> > Vinod
> >
>
>|||Hi Tibor,
I tried using the same account and same passwords in both the domains, but
that didnot work.
Thanks,
Vinod
"Tibor Karaszi" wrote:
> I believe that your only option is to create the same account (and same password) in both domains.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> > Hi All,
> >
> > We have two different domains in our environment, say ABC and XYZ, and they
> > are not trusted. I login into my PC using ABC domain .
> >
> > I have windows authenticated login in SQLServer that is in XYZ domain.
> >
> > Can anyone tell me how I can connect to SQL server that is in different
> > domain using Enterprise Manager or query analyzer?
> >
> > Thanks,
> > Vinod
> >
>|||Hi,
Yes, you would never be able to see servers from both domains in one
instance of EM.
--
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:63AA4081-792D-4267-8347-DAE6F36A5716@.microsoft.com...
> Hi Dan,
> Thanks for the info. This is working. But it is failing for SQLServers
> that are in ABC domain. It looks like I have to maintain two different
> shortcuts for Enterprise manager one for each domain.
> Thanks,
> Vinod
> "dan artuso" wrote:
>> Hi,
>> You can try doing a Run As ...
>> Shift + Right Click on EM shortcut and select Run As ...
>> Enter your other domain user credentials in the form:
>> domain\username
>> password
>> I'm not 100% sure that this will work though. Is your computer a member
>> of
>> both domains?
>> It will somehow have to authenticate your credentials with the other
>> domain.
>> --
>> HTH
>> Dan Artuso
>>
>> "VM" <VM@.discussions.microsoft.com> wrote in message
>> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
>> > Hi All,
>> >
>> > We have two different domains in our environment, say ABC and XYZ, and
>> > they
>> > are not trusted. I login into my PC using ABC domain .
>> >
>> > I have windows authenticated login in SQLServer that is in XYZ domain.
>> >
>> > Can anyone tell me how I can connect to SQL server that is in different
>> > domain using Enterprise Manager or query analyzer?
>> >
>> > Thanks,
>> > Vinod
>> >
>>

Connection between two domains

Hi All,
We have two different domains in our environment, say ABC and XYZ, and they
are not trusted. I login into my PC using ABC domain .
I have windows authenticated login in SQLServer that is in XYZ domain.
Can anyone tell me how I can connect to SQL server that is in different
domain using Enterprise Manager or query analyzer?
Thanks,
Vinod
Hi,
You can try doing a Run As ...
Shift + Right Click on EM shortcut and select Run As ...
Enter your other domain user credentials in the form:
domain\username
password
I'm not 100% sure that this will work though. Is your computer a member of
both domains?
It will somehow have to authenticate your credentials with the other domain.
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and
> they
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>
|||I believe that your only option is to create the same account (and same password) in both domains.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"VM" <VM@.discussions.microsoft.com> wrote in message
news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
> Hi All,
> We have two different domains in our environment, say ABC and XYZ, and they
> are not trusted. I login into my PC using ABC domain .
> I have windows authenticated login in SQLServer that is in XYZ domain.
> Can anyone tell me how I can connect to SQL server that is in different
> domain using Enterprise Manager or query analyzer?
> Thanks,
> Vinod
>
|||Hi Dan,
Thanks for the info. This is working. But it is failing for SQLServers
that are in ABC domain. It looks like I have to maintain two different
shortcuts for Enterprise manager one for each domain.
Thanks,
Vinod
"dan artuso" wrote:

> Hi,
> You can try doing a Run As ...
> Shift + Right Click on EM shortcut and select Run As ...
> Enter your other domain user credentials in the form:
> domain\username
> password
> I'm not 100% sure that this will work though. Is your computer a member of
> both domains?
> It will somehow have to authenticate your credentials with the other domain.
> --
> HTH
> Dan Artuso
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
>
>
|||Hi Tibor,
I tried using the same account and same passwords in both the domains, but
that didnot work.
Thanks,
Vinod
"Tibor Karaszi" wrote:

> I believe that your only option is to create the same account (and same password) in both domains.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "VM" <VM@.discussions.microsoft.com> wrote in message
> news:43B7970B-20A6-465E-8083-5D1C6C25FF59@.microsoft.com...
>
|||Hi,
Yes, you would never be able to see servers from both domains in one
instance of EM.
HTH
Dan Artuso
"VM" <VM@.discussions.microsoft.com> wrote in message
news:63AA4081-792D-4267-8347-DAE6F36A5716@.microsoft.com...[vbcol=seagreen]
> Hi Dan,
> Thanks for the info. This is working. But it is failing for SQLServers
> that are in ABC domain. It looks like I have to maintain two different
> shortcuts for Enterprise manager one for each domain.
> Thanks,
> Vinod
> "dan artuso" wrote:

Connection : trusted

Hi all, in one of my newly configured SQL server logs, I found a error
message like this:
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection.
Also in both of my new servers , SQL server logs following message repeated
all the time with differefnt date.
Login succeeded for user 'domain\user1'. Connection: Trusted.
And I couldn't find any similar log messages from the current production
server.
Any ideas? did I do something wrong when I set up new servers?
Thanks a lot.Your server is not configures for mixed authentication, that why he is
accepting domain users but not the SQL Users:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_47u6.asp
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"Catelin Wang" <CatelinWang@.discussions.microsoft.com> schrieb im
Newsbeitrag news:C3AF754C-DF7F-4D5F-A75E-2A11F9D9559A@.microsoft.com...
> Hi all, in one of my newly configured SQL server logs, I found a error
> message like this:
> Login failed for user 'sa'. Reason: Not associated with a trusted SQL
> Server
> connection.
> Also in both of my new servers , SQL server logs following message
> repeated
> all the time with differefnt date.
> Login succeeded for user 'domain\user1'. Connection: Trusted.
> And I couldn't find any similar log messages from the current production
> server.
> Any ideas? did I do something wrong when I set up new servers?
> Thanks a lot.|||thanks. But my production server is using the same authentication, why I did
not see the same logs messages?
"Jens Sü�meyer" wrote:
> Your server is not configures for mixed authentication, that why he is
> accepting domain users but not the SQL Users:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_security_47u6.asp
> HTH, Jens Suessmeyer.
> --
> http://www.sqlserver2005.de
> --
> "Catelin Wang" <CatelinWang@.discussions.microsoft.com> schrieb im
> Newsbeitrag news:C3AF754C-DF7F-4D5F-A75E-2A11F9D9559A@.microsoft.com...
> > Hi all, in one of my newly configured SQL server logs, I found a error
> > message like this:
> > Login failed for user 'sa'. Reason: Not associated with a trusted SQL
> > Server
> > connection.
> >
> > Also in both of my new servers , SQL server logs following message
> > repeated
> > all the time with differefnt date.
> >
> > Login succeeded for user 'domain\user1'. Connection: Trusted.
> >
> > And I couldn't find any similar log messages from the current production
> > server.
> > Any ideas? did I do something wrong when I set up new servers?
> >
> > Thanks a lot.
>
>|||Then you have not set the same security options for the new server.
Apparently one of the servers is set to audit all login attempts, the other
is set to audit successful logins.|||You are right, I set different audit trace for the two servers, but I how can
I find if I set to log successful logins '
Thanks a lot!
"Scott Morris" wrote:
> Then you have not set the same security options for the new server.
> Apparently one of the servers is set to audit all login attempts, the other
> is set to audit successful logins.
>
>|||Documentation? BOL -> Search -> "login failure"|||Thnaks, I found it.
"Scott Morris" wrote:
> Documentation? BOL -> Search -> "login failure"
>
>

connection

how to overcome this error "SELECT permission denied on object 'UserDetails', database 'LOGIN', schema 'dbo'."

you have to give your user, or all users (public) rights to select from this table

USE LOGIN;GRANT SELECT ON OBJECT::dbo.USERDETAILS TO PUBLIC;GO
|||

for this question

"(how to overcome this error "SELECT permission denied on object 'UserDetails', database 'LOGIN', schema 'dbo'.")"

u have given answer the answer as

you have to give your user, or all users (public) rights to select from this table

USE LOGIN;
GRANT SELECT ON OBJECT::dbo.USERDETAILS TO PUBLIC;
GO

Where I have to write the code given by u

my requirement is asp.net2.0 using sqlserver.

I have created a Login database in sqlserver2005 and trying to access the connection but it is giving the error as

"SELECT permission denied on object 'UserDetails', database 'LOGIN', schema 'dbo'."

plz say how to set permission in sqlserver to access the data"LOGIN" ,schema 'dbo'"

Sunday, February 12, 2012

Connecting to SQL Server with a login form.

Hi all,

I'm new to VB and VB.net and forms and everything, so please bare with me :)

I am constructing an application which is connected to sql server 2000. What I want to do is have the Login form open upon startup then have an option group where the user states if he wants to use NT or SQL Server authentication. . Then I want a combobox which looks up all the current sql servers there are on the network, so that the user chooses the sql server that it connects to. or if that's not possible, just a textbox with the sql server and database name.

I already have the option group (although I don't know how to get their values, I worked with plain old MS Access before this)

#1: What will my connection string look like?
#2: How will I tell my application which type the user selected?
#3: How can I save the credentials in my application when the user logs in so that I can use that credentials throughout the application?

Thanks

Rudi



if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}


http://www.connectionstrings.com for information about connection strings
To save the information and be able to use it throughout the class you may look at use the Singleton class model
you would copy their code snippet and simply add public members or properties to store your information in.
|||Hi Marc,

Thanks for the help, but I don't have a clue how to use that singletone thing. How would I go about making the connection public and carrying over the connection string to main main form (MDI Container) and then use it in my mdi child forms?

Another thing, I'm battling this stupid as to when clicking the login button to get the login box closed (not hidden) and opening the main form. Up until now the main form flashes on the screen and the application ends.

Any ideas?

btw, I'm using vb.net as my language.

Thanks|||Your form is disappearing probably because whenever the startup form is closed that signals the application to exit.

|||

Dear MarcD,

If i'm using MS Access as my database..
Will I need sum ting as tis too?

if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}

And I do not know how to code my login verification.
Please giv sum guide!

Thanks & GOD bless!
Jesse

|||

In case of sqlserver we are having differnt types of values for connection for examle

con.connectionstring=" Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=sridb;Data Source=xvz;"

ok

Ur 2nd ?

Regarding the type of user u want to select

We are having (Windows) Principal and permission classes U have to include the libraries and u have to write the code

Dim MyIdentity As WindowsIdentity = WindowsIdentity.GetCurrent()

'Put the previous identity into a principal object.
Dim MyPrincipal As New WindowsPrincipal(MyIdentity)

'Principal values.
Dim PrincipalName As String = MyPrincipal.Identity.Name
Dim PrincipalType As String = MyPrincipal.Identity.AuthenticationType
Dim PrincipalAuth As String = MyPrincipal.Identity.IsAuthenticated.ToString()

'Identity values.
Dim IdentName As String = MyIdentity.Name
Dim IdentType As String = MyIdentity.AuthenticationType
Dim IdentIsAuth As String = MyIdentity.IsAuthenticated.ToString()
Dim IsG As String = MyIdentity.IsGuest.ToString()
Dim IsSys As String = MyIdentity.IsSystem.ToString()
Dim Token As String = MyIdentity.Token.ToString()

Connecting to SQL Server with a login form.

Hi all,

I'm new to VB and VB.net and forms and everything, so please bare with me :)

I am constructing an application which is connected to sql server 2000. What I want to do is have the Login form open upon startup then have an option group where the user states if he wants to use NT or SQL Server authentication. . Then I want a combobox which looks up all the current sql servers there are on the network, so that the user chooses the sql server that it connects to. or if that's not possible, just a textbox with the sql server and database name.

I already have the option group (although I don't know how to get their values, I worked with plain old MS Access before this)

#1: What will my connection string look like?
#2: How will I tell my application which type the user selected?
#3: How can I save the credentials in my application when the user logs in so that I can use that credentials throughout the application?

Thanks

Rudi



if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}


http://www.connectionstrings.com for information about connection strings
To save the information and be able to use it throughout the class you may look at use the Singleton class model
you would copy their code snippet and simply add public members or properties to store your information in.
|||Hi Marc,

Thanks for the help, but I don't have a clue how to use that singletone thing. How would I go about making the connection public and carrying over the connection string to main main form (MDI Container) and then use it in my mdi child forms?

Another thing, I'm battling this stupid as to when clicking the login button to get the login box closed (not hidden) and opening the main form. Up until now the main form flashes on the screen and the application ends.

Any ideas?

btw, I'm using vb.net as my language.

Thanks|||Your form is disappearing probably because whenever the startup form is closed that signals the application to exit.

|||

Dear MarcD,

If i'm using MS Access as my database..
Will I need sum ting as tis too?

if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}

And I do not know how to code my login verification.
Please giv sum guide!

Thanks & GOD bless!
Jesse

|||

In case of sqlserver we are having differnt types of values for connection for examle

con.connectionstring=" Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=sridb;Data Source=xvz;"

ok

Ur 2nd ?

Regarding the type of user u want to select

We are having (Windows) Principal and permission classes U have to include the libraries and u have to write the code

Dim MyIdentity As WindowsIdentity = WindowsIdentity.GetCurrent()

'Put the previous identity into a principal object.
Dim MyPrincipal As New WindowsPrincipal(MyIdentity)

'Principal values.
Dim PrincipalName As String = MyPrincipal.Identity.Name
Dim PrincipalType As String = MyPrincipal.Identity.AuthenticationType
Dim PrincipalAuth As String = MyPrincipal.Identity.IsAuthenticated.ToString()

'Identity values.
Dim IdentName As String = MyIdentity.Name
Dim IdentType As String = MyIdentity.AuthenticationType
Dim IdentIsAuth As String = MyIdentity.IsAuthenticated.ToString()
Dim IsG As String = MyIdentity.IsGuest.ToString()
Dim IsSys As String = MyIdentity.IsSystem.ToString()
Dim Token As String = MyIdentity.Token.ToString()

Connecting to SQL Server with a login form.

Hi all,

I'm new to VB and VB.net and forms and everything, so please bare with me :)

I am constructing an application which is connected to sql server 2000. What I want to do is have the Login form open upon startup then have an option group where the user states if he wants to use NT or SQL Server authentication. . Then I want a combobox which looks up all the current sql servers there are on the network, so that the user chooses the sql server that it connects to. or if that's not possible, just a textbox with the sql server and database name.

I already have the option group (although I don't know how to get their values, I worked with plain old MS Access before this)

#1: What will my connection string look like?
#2: How will I tell my application which type the user selected?
#3: How can I save the credentials in my application when the user logs in so that I can use that credentials throughout the application?

Thanks

Rudi



if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}


http://www.connectionstrings.com for information about connection strings
To save the information and be able to use it throughout the class you may look at use the Singleton class model
you would copy their code snippet and simply add public members or properties to store your information in.
|||Hi Marc,

Thanks for the help, but I don't have a clue how to use that singletone thing. How would I go about making the connection public and carrying over the connection string to main main form (MDI Container) and then use it in my mdi child forms?

Another thing, I'm battling this stupid as to when clicking the login button to get the login box closed (not hidden) and opening the main form. Up until now the main form flashes on the screen and the application ends.

Any ideas?

btw, I'm using vb.net as my language.

Thanks|||Your form is disappearing probably because whenever the startup form is closed that signals the application to exit.

|||

Dear MarcD,

If i'm using MS Access as my database..
Will I need sum ting as tis too?

if (rdoUseSqlAuth.Checked==true)
{
// user chose sql auth
}
else if (rdoUseWindowsAuth.Checked==true)
{
/// user chose windows auth
}

And I do not know how to code my login verification.
Please giv sum guide!

Thanks & GOD bless!
Jesse

|||

In case of sqlserver we are having differnt types of values for connection for examle

con.connectionstring=" Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=sridb;Data Source=xvz;"

ok

Ur 2nd ?

Regarding the type of user u want to select

We are having (Windows) Principal and permission classes U have to include the libraries and u have to write the code

Dim MyIdentity As WindowsIdentity = WindowsIdentity.GetCurrent()

'Put the previous identity into a principal object.
Dim MyPrincipal As New WindowsPrincipal(MyIdentity)

'Principal values.
Dim PrincipalName As String = MyPrincipal.Identity.Name
Dim PrincipalType As String = MyPrincipal.Identity.AuthenticationType
Dim PrincipalAuth As String = MyPrincipal.Identity.IsAuthenticated.ToString()

'Identity values.
Dim IdentName As String = MyIdentity.Name
Dim IdentType As String = MyIdentity.AuthenticationType
Dim IdentIsAuth As String = MyIdentity.IsAuthenticated.ToString()
Dim IsG As String = MyIdentity.IsGuest.ToString()
Dim IsSys As String = MyIdentity.IsSystem.ToString()
Dim Token As String = MyIdentity.Token.ToString()

Friday, February 10, 2012

Connecting to SQL Server from a Web Service: login failed.

I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
setting:
<add name="SqlServerTrustedConn"
providerName="System.Data.SqlClient"
connectionString="Data Source=localhost;Initial
Catalog=GTSDB;Integrated Security=SSPI;" />
All worked great with my windows application.
Now I've copied the DAL of the windows application into a Web Service
project and when I open a connection I get the following exception:
Cannot open database "GTSDB" requested by the login. The login failed.
Login failed for user 'PCNAME\ASPNET'.
Since remote connections are disabled by default I've used the Surface Area
Configuration tool to enable them.
Then I've created a SQL login for the ASPNET account:
CREATE LOGIN [PCNAME\ASPNET] FROM WINDOWS
Since it didn't work I deleted the SQL login for the ASPNET account:
DROP LOGIN [PCNAME\ASPNET]
I've determined that PCNAME\WINDOWSUSER is the database owner:
select suser_sname(owner_sid) from sys.databases where name = 'GTSDB'
I've verified that 'sa' is the database owner according to the information
stored in the database itself:
select suser_sname(sid) from sysusers where uid = user_id('dbo')
I've found that the PCNAME\ASPNET login is not mapped to any user in the
database (the below query did not return a row):
(select * from sysusers where sid = suser_sid('PCNAME\ASPNET'))
I've done the mapping:
CREATE USER [PCNAME\ASPNET] (DROP USER [PCNAME\ASPNET] to reset to
initial state)
I've verified that the user had permission to connect to the database:
select * from sys.database_permissions where grantee_principal_id =
user_id('user_name')
I've tried changing localhost to 192.168.x.x receiving the following
exception even if I enable mixed mode:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.
What can I do?
Thanks,
Luigi.
Have you considered running the ASP.NET application under a user account
which has access to the database? Giving anything access to the ASP.NET
account is generally a bad idea. Create an account specifically for your
application and then configure the app to run under that account. Then give
that account the appropriate persmissions in the database.
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com
"BLUE" <blue> wrote in message news:OrZOoI5qHHA.3248@.TK2MSFTNGP03.phx.gbl...
> I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
> setting:
> <add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
>
> All worked great with my windows application.
> Now I've copied the DAL of the windows application into a Web Service
> project and when I open a connection I get the following exception:
> Cannot open database "GTSDB" requested by the login. The login failed.
> Login failed for user 'PCNAME\ASPNET'.
>
> Since remote connections are disabled by default I've used the Surface
> Area Configuration tool to enable them.
> Then I've created a SQL login for the ASPNET account:
> CREATE LOGIN [PCNAME\ASPNET] FROM WINDOWS
> Since it didn't work I deleted the SQL login for the ASPNET account:
> DROP LOGIN [PCNAME\ASPNET]
> I've determined that PCNAME\WINDOWSUSER is the database owner:
> select suser_sname(owner_sid) from sys.databases where name = 'GTSDB'
> I've verified that 'sa' is the database owner according to the information
> stored in the database itself:
> select suser_sname(sid) from sysusers where uid = user_id('dbo')
> I've found that the PCNAME\ASPNET login is not mapped to any user in the
> database (the below query did not return a row):
> (select * from sysusers where sid = suser_sid('PCNAME\ASPNET'))
> I've done the mapping:
> CREATE USER [PCNAME\ASPNET] (DROP USER [PCNAME\ASPNET] to reset to
> initial state)
> I've verified that the user had permission to connect to the database:
> select * from sys.database_permissions where grantee_principal_id =
> user_id('user_name')
>
> I've tried changing localhost to 192.168.x.x receiving the following
> exception even if I enable mixed mode:
> Login failed for user ''. The user is not associated with a trusted SQL
> Server connection.
>
> What can I do?
>
> Thanks,
> Luigi.
>
|||BLUE (blue) writes:
> I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
> setting:
><add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
>
> All worked great with my windows application.
> Now I've copied the DAL of the windows application into a Web Service
> project and when I open a connection I get the following exception:
And does the web server run on the same machine as the SQL Server? Well,
apparently there is an SQL Server instance on the web server, since you
get an error message like:

> Cannot open database "GTSDB" requested by the login. The login failed.
> Login failed for user 'PCNAME\ASPNET'.
But is it the right instance? That is, the one with the GTSDB database?
I ask this, because you later say:

> I've tried changing localhost to 192.168.x.x receiving the following
> exception even if I enable mixed mode:
> Login failed for user ''. The user is not associated with a trusted SQL
> Server connection.
That indicates that you now specify a different server? Or is
192.168.x.x the address of your machine?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||>
> What can I do?
> <add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
You need to take out the Integrated Security and use a generic user-id and
psw.
The user-id and psw needs to be created for the SQL Server database with the
appropriate access permissions to access the database.
|||Sorry, I've forgot saying that localhost, 127.0.0.1, 192.168.x.x all refers
to the same machine, that is my only one pc on wich I have XP SP2, IIS and
SQL Server 2005 Developer edition.
I'm not an expert administrator so I simply installed IIS and SQL Server
without creating multiple instances or somethin strange.
I only know that with my windows app and the same connection string all
works and I think this means the instance is only one and with the GTSDB
inside.

> Have you considered running the ASP.NET application under a user account
> which has access to the database?
> Create an account specifically for your application and then configure the
> app to run under that account.
> Then give that account the appropriate persmissions in the database.
Sorry for my "newbieness" but I do not now how to do the things you have
suggested me :-(
Thanks,
Luigi.
|||Mr. Arnold (MR. Arnold@.Arnold.com) writes:
> You need to take out the Integrated Security and use a generic user-id and
> psw.
> The user-id and psw needs to be created for the SQL Server database with
> the appropriate access permissions to access the database.
Since "BLUE" did not seem to know this, here are the steps:
First make sure SQL Server runs in mixed mode. (You seemed to know how to do
that).
Then:
CREATE LOGIN mygenericuser WITH PASSWORD='VeRy Str8Ng P@.wrd'
and in the target database:
CREATE USER mygenericuser
In the connection string, replace "Integrated Securuty=SSPI" with
"User ID=MyGenericUser;Password={VeRy Str8Ng P@.wrd}".
Now I have a question for the ASP .Net folks: why is the build in
ASPNET login to good to use?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||You have saved me!
Thank you very much,
Luigi.
|||> Now I have a question for the ASP .Net folks: why is the build in
> ASPNET login to good to use?
I don't think it's "to good" to use, but generally the database server
is different from the webserver. The ASPNET account (or NETWORK SERVICES)
is a local account (local to the webserver that is), and is not know
on the db-server. So either you use a domain account or integrated security.
Hans Kesting
|||It was with integrated security that didn't work for me.
I'm curious to know a working integrated security connection string or way
to use integrated security from ASP.NET web service.
Bye,
Luigi.
|||Hans Kesting (news.2.hansdk@.spamgourmet.com) writes:
>
> I don't think it's "to good" to use, but generally the database server
> is different from the webserver. The ASPNET account (or NETWORK
> SERVICES) is a local account (local to the webserver that is), and is
> not know on the db-server. So either you use a domain account or
> integrated security.
Sorry, I meant to say "...login not good to use".
Thanks for the information about ASPNET being a local account, and thus
will not work when the database server is on a different box. That does
not seem to be the case for BLUE - but that might only be as long as he
is developing. The day he deploys it, they may be on different boxes,
and then integrated security is not going to work then.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Connecting to SQL Server from a Web Service: login failed.

I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
setting:
<add name="SqlServerTrustedConn"
providerName="System.Data.SqlClient"
connectionString="Data Source=localhost;Initial
Catalog=GTSDB;Integrated Security=SSPI;" />
All worked great with my windows application.
Now I've copied the DAL of the windows application into a Web Service
project and when I open a connection I get the following exception:
Cannot open database "GTSDB" requested by the login. The login failed.
Login failed for user 'PCNAME\ASPNET'.
Since remote connections are disabled by default I've used the Surface Area
Configuration tool to enable them.
Then I've created a SQL login for the ASPNET account:
CREATE LOGIN [PCNAME\ASPNET] FROM WINDOWS
Since it didn't work I deleted the SQL login for the ASPNET account:
DROP LOGIN [PCNAME\ASPNET]
I've determined that PCNAME\WINDOWSUSER is the database owner:
select suser_sname(owner_sid) from sys.databases where name = 'GTSDB'
I've verified that 'sa' is the database owner according to the information
stored in the database itself:
select suser_sname(sid) from sysusers where uid = user_id('dbo')
I've found that the PCNAME\ASPNET login is not mapped to any user in the
database (the below query did not return a row):
(select * from sysusers where sid = suser_sid('PCNAME\ASPNET'))
I've done the mapping:
CREATE USER [PCNAME\ASPNET] (DROP USER [PCNAME\ASPNET] to reset
to
initial state)
I've verified that the user had permission to connect to the database:
select * from sys.database_permissions where grantee_principal_id =
user_id('user_name')
I've tried changing localhost to 192.168.x.x receiving the following
exception even if I enable mixed mode:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.
What can I do?
Thanks,
Luigi.Have you considered running the ASP.NET application under a user account
which has access to the database? Giving anything access to the ASP.NET
account is generally a bad idea. Create an account specifically for your
application and then configure the app to run under that account. Then give
that account the appropriate persmissions in the database.
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com
"BLUE" <blue> wrote in message news:OrZOoI5qHHA.3248@.TK2MSFTNGP03.phx.gbl...
> I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
> setting:
> <add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
>
> All worked great with my windows application.
> Now I've copied the DAL of the windows application into a Web Service
> project and when I open a connection I get the following exception:
> Cannot open database "GTSDB" requested by the login. The login failed.
> Login failed for user 'PCNAME\ASPNET'.
>
> Since remote connections are disabled by default I've used the Surface
> Area Configuration tool to enable them.
> Then I've created a SQL login for the ASPNET account:
> CREATE LOGIN [PCNAME\ASPNET] FROM WINDOWS
> Since it didn't work I deleted the SQL login for the ASPNET account:
> DROP LOGIN [PCNAME\ASPNET]
> I've determined that PCNAME\WINDOWSUSER is the database owner:
> select suser_sname(owner_sid) from sys.databases where name = 'GTSDB'
> I've verified that 'sa' is the database owner according to the information
> stored in the database itself:
> select suser_sname(sid) from sysusers where uid = user_id('dbo')
> I've found that the PCNAME\ASPNET login is not mapped to any user in the
> database (the below query did not return a row):
> (select * from sysusers where sid = suser_sid('PCNAME\ASPNET'))
> I've done the mapping:
> CREATE USER [PCNAME\ASPNET] (DROP USER [PCNAME\ASPNET] to rese
t to
> initial state)
> I've verified that the user had permission to connect to the database:
> select * from sys.database_permissions where grantee_principal_id =
> user_id('user_name')
>
> I've tried changing localhost to 192.168.x.x receiving the following
> exception even if I enable mixed mode:
> Login failed for user ''. The user is not associated with a trusted SQL
> Server connection.
>
> What can I do?
>
> Thanks,
> Luigi.
>|||BLUE (blue) writes:
> I'm using SQL Server 2005 Developer Edition on Windows XP SP2 with this
> setting:
><add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
>
> All worked great with my windows application.
> Now I've copied the DAL of the windows application into a Web Service
> project and when I open a connection I get the following exception:
And does the web server run on the same machine as the SQL Server? Well,
apparently there is an SQL Server instance on the web server, since you
get an error message like:

> Cannot open database "GTSDB" requested by the login. The login failed.
> Login failed for user 'PCNAME\ASPNET'.
But is it the right instance? That is, the one with the GTSDB database?
I ask this, because you later say:

> I've tried changing localhost to 192.168.x.x receiving the following
> exception even if I enable mixed mode:
> Login failed for user ''. The user is not associated with a trusted SQL
> Server connection.
That indicates that you now specify a different server? Or is
192.168.x.x the address of your machine?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||>
> What can I do?
> <add name="SqlServerTrustedConn"
> providerName="System.Data.SqlClient"
> connectionString="Data Source=localhost;Initial
> Catalog=GTSDB;Integrated Security=SSPI;" />
You need to take out the Integrated Security and use a generic user-id and
psw.
The user-id and psw needs to be created for the SQL Server database with the
appropriate access permissions to access the database.|||Sorry, I've forgot saying that localhost, 127.0.0.1, 192.168.x.x all refers
to the same machine, that is my only one pc on wich I have XP SP2, IIS and
SQL Server 2005 Developer edition.
I'm not an expert administrator so I simply installed IIS and SQL Server
without creating multiple instances or somethin strange.
I only know that with my windows app and the same connection string all
works and I think this means the instance is only one and with the GTSDB
inside.

> Have you considered running the ASP.NET application under a user account
> which has access to the database?
> Create an account specifically for your application and then configure the
> app to run under that account.
> Then give that account the appropriate persmissions in the database.
Sorry for my "newbieness" but I do not now how to do the things you have
suggested me :-(
Thanks,
Luigi.|||Mr. Arnold (MR. Arnold@.Arnold.com) writes:
> You need to take out the Integrated Security and use a generic user-id and
> psw.
> The user-id and psw needs to be created for the SQL Server database with
> the appropriate access permissions to access the database.
Since "BLUE" did not seem to know this, here are the steps:
First make sure SQL Server runs in mixed mode. (You seemed to know how to do
that).
Then:
CREATE LOGIN mygenericuser WITH PASSWORD='VeRy Str8Ng P@.wrd'
and in the target database:
CREATE USER mygenericuser
In the connection string, replace "Integrated Securuty=SSPI" with
"User ID=MyGenericUser;Password={VeRy Str8Ng P@.wrd}".
Now I have a question for the ASP .Net folks: why is the build in
ASPNET login to good to use?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||
> Now I have a question for the ASP .Net folks: why is the build in
> ASPNET login to good to use?
That's a good question. I'll be interested in seeing an answer.|||You have saved me!
Thank you very much,
Luigi.|||> Now I have a question for the ASP .Net folks: why is the build in
> ASPNET login to good to use?
I don't think it's "to good" to use, but generally the database server
is different from the webserver. The ASPNET account (or NETWORK SERVICES)
is a local account (local to the webserver that is), and is not know
on the db-server. So either you use a domain account or integrated security.
Hans Kesting|||It was with integrated security that didn't work for me.
I'm curious to know a working integrated security connection string or way
to use integrated security from ASP.NET web service.
Bye,
Luigi.