Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't connect too SQL database (login failed)

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I'm trying to connect to SQL server 7<br>I created the ODBC Machine DSN on the server where the .asp is runnign I'm using IIS 4<br>here is my code<br>----------------------------<br>&lt;%@ Language=VBScript %&gt; <br>&lt;html&gt;<br><br>&lt;head&gt;<br>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&gt;<br>&lt;meta name=&quot;GENERATOR&quot; content=&quot;Microsoft FrontPage 4.0&quot;&gt;<br>&lt;meta name=&quot;ProgId&quot; content=&quot;FrontPage.Editor.Document&quot;&gt;<br>&lt;title&gt;New Page 2&lt;/title&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br>&lt;%&nbsp;&nbsp;Response.Write(&quot;These records are pulled from a SQL Server database&quot;)&nbsp;&nbsp;%&gt; <br>&lt;%<br>Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)<br>Conn.Open &quot;People&quot;<br>Set RS = Conn.Execute(&quot;SELECT * FROM Persons&quot;)<br>If Not RS.EOF Then<br> Do<br> Response.Write RS(&quot;PersonFName&quot;) & &quot; &quot; & RS(&quot;PersonLName&quot;)<br> RS.Movenext<br> Loop Until RS.EOF<br>Else<br> msgbox &quot;Empty Baby&quot;<br>End If<br>%&gt;<br>&lt;/body&gt;<br><br>&lt;/html&gt;<br>-------------------------------------<br>here is the result page<br><br><br>These records are pulled from a SQL Server database <br>Microsoft OLE DB Provider for ODBC Drivers error '80040e4d' <br><br>[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'SBSDOMAIN\IUSR_SMALLBSERVER'. <br><br>/test2.asp, line 15 <br>-----------------------<br>Line 15 is the connect line:<br>Conn.Open &quot;People&quot;<br><br>Any Ideas???<br><br>I have an Access database that I wrote a similar test pasge for ant it works just fine.<br>TIA<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
um is &quot;People&quot; your DSN name?, also in the Open, try something like <br>Conn.Open &quot;People&quot;, &quot;sa&quot;, &quot;&quot;<br><br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Um Yes already tried both<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
when you created the DSN, did you test the connection at the time of adding? <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Yes of course<br>I can go to my PC and create a connection to in Access so I know it works.<br>I'm missing something on ASP side, a Permission thing.<br><br>Or I'm not picking the right user.<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
You need to add the IUSR_***** account to your SQL Server logins and make sure that the account has permissions on your database.
 
Hi DougP<br>Try this one <br><br><FONT FACE=monospace> Con.Open &quot;dsn=dsnname;uid=username;pwd=password;&quot;</font><br><br>Hope it works <br>&nbsp;Enjoy!<br>&nbsp;<br> <p>Unicorn11<br><a href=mailto:webmaster@tripmedia.com>webmaster@tripmedia.com</a><br><a href= > </a><br>Hi there it all likeminded fellows!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top