Connection Exception

  • Thread starter Thread starter Andrew Chalk
  • Start date Start date
A

Andrew Chalk

When I try to run my WinForms app. I get the exception below while trying to
connect to a remote database with the following connect string:

private static string sCon = "NETWORK library=dbmssocn;data
source=192.168.0.6,1433;initial catalog=Fred;user ID=IUSR_AJC2;Password=";

Unhandled Exception: System.Data.SqlClient.SqlException: Login failed for
user 'IUSR_AJC2'. Reason: Not associated with a trusted SQL Server
connection.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at Callview1.frmMain..ctor() in d:\work\logger\callview1\main.cs:line 189
at Callview1.frmMain.Main() in d:\work\logger\callview1\main.cs:line 1197
Can anybody explain what the problem is here? How do I associate this login
with a trusted SQL connection?
Thanks!
 
You need to 1) Verify that IUSR_AJC2 does in fact have permission on the
SQL Server. Without this, the DB won't let you in. Next, Replace the ID
and Password fields with Integrated Security = SSPI. When you use a trust,
SQL Server trusts that the DC has already authenticated you and that you are
who you cliam to be. As such, if knows your username and password so you
don't need to pass them in.

"Data Source=192.168.0.6, 1433;Initial Catalog=Fred;Integrated
Security=SSPI;"

HTH,

Bill
 
Thanks, William. It appears that with the following connection string:

data source=192.168.0.6,1433;initial catalog=Fred;integrated security=SSPI

I can connect from within the VS.NET environment but not from a browser with
http://localhost/CallviewDebug/Callview1.exe

The difference would appear to be that the former is in the "My Computer"
zone whereas the latter is in the "Local Intranet" zone. So what I need to
know is how to get my app. to run from "Local Intranet" or Internet?

Many thanks.
 
You are going to have to adjust you local security settings (which isn't too
big of a deal on most networks b/c it's your internal network - connecting
to the Internet on the other hand, takes a bit more consideration and
planning). you can just use the Security Configuration wizards and bump up
the local network settings.

HTH,

Bill
 
Back
Top