Re: Can't Connect



Then it's likely the authentication settings on the IIS side
of it. Try adding the IUSR account as a login in SQL Server
with the appropriate permissions as needed for your code.
Also, turned on failed login audits in SQL Server and
restart the instance. That will help you track down what
login is failing.

-Sue

On Tue, 20 Sep 2005 10:17:50 GMT, "Jim Bunton"
<jBunton@xxxxxxxxxxxxxxxx> wrote:

>Thanks for your clear response Sue.
>
>Unfortunately I still have a problem:
>
>The following works:-
><%
>dim Cn, SqlStr,rsCustomers
> Set Cn=Server.CreateObject("ADODB.Connection")
> Cn.Provider = "sqloledb"
> Cn.Properties("Data Source") = "Study\StudySQLServer"
> Cn.Properties("Initial Catalog") = "NorthWind"
> Cn.Properties("Connect Timeout") = "3"
> Cn.Properties("User ID") = "sa"
> Cn.Properties("Password") = "mypassword"
> Cn.open
> . . . code which displays Customer info
>
>The folowing does NOT:-
><%
>dim Cn, CnStr, SqlStr,rsCustomers
> Set Cn=Server.CreateObject("ADODB.Connection")
> CnStr="Provider=sqloledb;" & _
> "Data Source=Study\StudySqlServer;" & _
> "Initial Catalog=NorthWind;" & _
> "Integrated Security=SSPI"
> response.write "cnStr = " & cnStr
> ' response.end
> Cn.open CnStr
>
>It fails at Cn.open CnStr
>Error Type:
>(0x80040E4D)
>/MyWebs/Connect_wAuth.asp, line 15
>
>response.write "cnStr = " & cnStr gives:-
>cnStr = Provider=sqloledb;Data Source=Study\StudySqlServer;Initial Catalog=NorthWind;Integrated Security=SSPI
>
>In Query Analyser (login using Windows Authentification)
>select user_Name() >> dbo
>select * from Customers >> a list of customers
>
>
>
>"Sue Hoegemeier" <Sue_H@xxxxxxxxxxxxx> wrote in message news:5tuui1l8ku9a5fl6r704knccn7jfun1kf4@xxxxxxxxxx
>> If you are using windows authentication (also known as a
>> trusted connection) to connect, you don't supply a user
>> name, password in the connection string. Instead, you
>> indicate this by using Integrated Security=SSPI
>> in your connection string.
>> You also want to make sure the database is correct. In your
>> examples, you want to make sure you use Northwind (you have
>> Norwind listed).
>> You can find sample connection strings using the SQL Server
>> OLE DB provider at:
>> http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProviderForSQLServer
>>
>> -Sue
>>
>> On Mon, 19 Sep 2005 11:44:58 GMT, "Jim Bunton"
>> <jBunton@xxxxxxxxxxxxxxxx> wrote:
>>
>> >Win 2000, sqlServer 2000 Personal edition
>> >
>> >Trying ot connect using .asp Vb Script
>> >
>> >1. Sql server set to use Windows Authentication
>> >2. Log onto Windows 2000 as Jim Bunton {no password)
>> >3 Server 'Study' running ok
>> >4. sql query analyser
>> > i. "SELECT User_Name > dbo
>> > ii. [using database NorthWind]
>> > "SELECT * FROM Customers" > gives expected result
>> >
>> >5. VB script
>> >** BEGIN CODE connect.asp ***
>> ><%
>> > @ LANGUAGE="VBSCRIPT"
>> >%>
>> >
>> ><%
>> > Option explicit
>> > response.expires = 0
>> >%>
>> >
>> ><!-- #include file="adovbs.inc" -->
>> >
>> ><html>
>> ><head>
>> ><title></title>
>> ></head>
>> ><body>
>> ><%
>> > dim Cn, CnStr
>> > Set Cn = Server.CreateObject("ADODB.Connection")
>> > Cn.ConnectionTimeOut = 1
>> > Cn.provider="sqloledb"
>> > response.write "Conn Provider is " & Cn.provider
>> > CnStr="Data Source=Study;Initial Catalog=Norhwind;User
>> >Id=sa;Password=;"
>> > ' Tried all sorts of user id's and paswords
>> >
>> > 'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id = 'Jim
>> >Bunton';Password=;"
>> > 'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id
>> >=dbo;Password=;"
>> > 'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id =
>> >JimBunton;Password=;"
>> > 'CnStr="Data Source='Study';Initial Catalogue='Norhwind';User Id
>> >='Study\Jim Bunton';Password=;"
>> >%>
>> ><p>----------</p>
>> ><%
>> > response.write "Cnstr = " & CnStr
>> > 'ERROR ALWAYS OCCURS ON NEXT LINEon the next line
>> > Cn.open CnStr
>> >%>
>> ><p>----------</p>
>> ><%
>> > response.write "The End - ran ok"
>> >%>
>> >
>> ></body>
>> >
>> ></html>
>> >
>> >**** END CODE *****
>> >
>> >? what to do??
>> >?? am I missing something 'obvious' out ???
>>

.



Relevant Pages

  • Re:changing sa password / login
    ... authentication and it worked. ... >I think you might have made changes to SQL Server ... >Authentication" can not recognize SA login which is SQL ... >configuration to use mixed authentication. ...
    (microsoft.public.sqlserver.security)
  • Re: Security question ..
    ... > If you use NT authentication, a user's permissions to a database are ... Your assertion that a user's permissions are independent of the application ... Even using Access and "exploring" will require an ODBC login to SQL Server. ...
    (microsoft.public.sqlserver.server)
  • Re:changing sa password / login
    ... I think you might have made changes to SQL Server ... to make was using Mixed Authentication which will ... Authentication" can not recognize SA login which is SQL ... configuration to use mixed authentication. ...
    (microsoft.public.sqlserver.security)
  • Re: Kerberos / Authentication to SQL2K
    ... use Windows integrated security for database access. ... That SQL Server be running on the same computer as IIS. ... > authentication until I switched on impersonation either. ... > When set up on my web server however, I get the "Login failed for user ...
    (microsoft.public.dotnet.framework.aspnet)
  • [Full-Disclosure] Advisory: Dark Age of Camelot - Weak encryption of network traffic exposed persona
    ... Weak encryption in game client exposed customer billing and authentication ... encryption for billing information. ... The login binary has undergone several updates since then. ...
    (Full-Disclosure)