SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Connection String works on 2 out of 3 machines. HELP

    I have A PC - Win 7 with Microsoft SQL Server Management Studio - 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    Microsoft Data Access Components (MDAC) - 6.1.7600.16385 (win7_rtm.090713-1255)
    Microsoft MSXML - 3.0 4.0 5.0 6.0
    Microsoft Internet Explorer - 8.0.7600.16385
    Microsoft .NET Framework - 2.0.50727.4952
    Operating System - 6.1.7600

    A laptop Vista and similar Microsoft SQL Server Management Studio.
    Both use the following Connection.asp:
    Code:
    <%
    Option Explicit
    Dim oConn
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.ConnectionString = "Provider=SQLNCLI10;Server=HAL\SQL;Database=hub;Trusted_Connection=No;User ID=hub_user;Password=hubuser;"
    %>
    A typical script looks like this:
    Code:
    <%@LANGUAGE=VBSCRIPT%><%
    ' Get_First.asp
    ' Return first record in table
    %>
    <!-- #include file="Connection.asp" -->
    <%
    Response.Expires = -1
    On Error Resume Next
    Dim dataArray, dataString, dbField, oRS1, stringSent
    stringSent = Request.QueryString("stringSent")
    stringSent = "*|App_Configuration|ID" 
    Set oRS1 = Server.CreateObject("ADODB.Recordset")
    oRS1.Open "SELECT * FROM App_Configuration ORDER BY ID" , oConn & "\", 3,3Response.Write "&recordCount="& oRS1.RecordCount
    If oRS1.RecordCount > 0 Then
    For Each dbField In oRS1.Fields
    	dataString = dataString & dbField.Value & "|"
    Next
    End If
    If Err.Number = 0 Then
      Response.Write "&dataString="& dataString
      Response.Write "&appCode=0"
      Else
      Response.Write "&appCode=1"
      Response.Write "&codeError=" & Err.Number
      Response.Write "&codeDescription=" & Err.description
     End If
    oRS1.Close
    Set oRS1 = Nothing
    'oConn.Close
    Set oConn = Nothing
    %>
    This is a working script.

    Now .. still with me?? The NON working machine is a server running:
    Microsoft SQL Server Management Studio - 10.0.1600.22 ((SQL_PreRelease).080709-1414 )
    Microsoft Data Access Components (MDAC) - 00.085.1132.00 (xpsp.080413-0852)
    Microsoft MSXML - 2.6 3.0 6.0
    Microsoft Internet Explorer - 8.0.6001.18702
    Microsoft .NET Framework - 2.0.50727.3615
    Operating System - 5.1.2600

    I can open Microsoft SQL Server Management Studio and look at the database. What I can't do is connect through asp to it.

    I get the following error message:
    Error Type:
    Microsoft SQL Server Native Client 10.0 (0x80040E4D)
    Login failed for user 'hub_user'.

    Here's the connection string:

    Code:
    <%
    Option Explicit
    Dim oConn
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.ConnectionString = "Provider=SQLNCLI10;Server=SJC-MASTER\SQLEXPRESS;Database=hub;Trusted_Connection=No;User ID=hub_user;Password=hub_user;"
    %>
    The error I get is:
    Error Type:
    Microsoft SQL Server Native Client 10.0 (0x80040E4D)
    Login failed for user 'hub_user'.

    The user is set up with SQL Authentication both at server level and db level.

    I have tried ALL day and most of the night, with every connection string variation I can think of ... so I turn to the experts. Can someone PLEASE help!?

  2. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,627
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The connection string is telling you the truth -- the hub_user does not exist in SJC-MASTER\SQLEXPRESS. You need to either create the user there or use another user that does exist.

  3. #3
    SitePoint Member
    Join Date
    Jan 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    ... it turned out to be something I've never had to do before ...

    Right-click on the Server Instance in the Object Explorer of MSSMS, Select The 'Security' option under 'Select a page" and change 'Server Authentication' to 'SQL Server and Windows Authentication mode'.

    Hope this helps someone else.

    And THANKS for the reply to my question though! Much appreciated.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •