Newbie
Newbie

Reputation: 231

ADO connection string Error

Sorry for the messy outlook. This is basically a .inc file for a asp website. Currently, we have migrated from our current MySQL to MSSQL 2008. In MySQL, im able to connect to the database. But im unable to connect it under MSSQL 2008. The script works fine in MySQL. Pls help.

Information 1 : I'm using Dreamweaver.

Information 2 : I have tried strConnect = "Provider=sqloledb;Library=DBMSSOCN;Data Source=xx.xx.xx.xx;1433; Initial Catalog=mydatabasename;User Id=userID;Password=password;"

Information 3 : I can't access to the database thru the website, this is the error msg i get 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

Information 4 :i'm lost for ideas. I searched everywhere in http://www.connectionstrings.com/sql-server-2008, http://support.microsoft.com/kb/238949, still no luck.

Information 5 : I have tried using .udl file to get the connection string. Whenever i test connection, it works perfectly shows connection passed

`<% On Error Resume Next
Set objConn = Nothing
strConnect = "Provider=sqloledb;Network Library=DBMSSOCN;Data Source=ABC-EF-SQLS01"
    "Initial Catalog=mydatabasename;"
    "User Id=userID;Password=password;" 
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open strConnect


Function UserIP()

    UserIP = Request.ServerVariables ( "HTTP_X_FORWARD_FOR" )

    If UserIP = "" Then

        UserIP = Request.ServerVariables ( "REMOTE_ADDR" )

    End If

End Function 


Function BinaryToString(Binary)


  Dim cl1, cl2, cl3, pl1, pl2, pl3
  Dim L
  cl1 = 1
  cl2 = 1
  cl3 = 1
  L = LenB(Binary)

  Do While cl1<=L
    pl3 = pl3 & Chr(AscB(MidB(Binary,cl1,1)))
    cl1 = cl1 + 1
    cl3 = cl3 + 1
    If cl3>300 Then
      pl2 = pl2 & pl3
      pl3 = ""
      cl3 = 1
      cl2 = cl2 + 1
      If cl2>200 Then
    pl1 = pl1 & pl2
    pl2 = ""
    cl2 = 1
      End If
    End If
  Loop
  BinaryToString = nl2br(pl1 & pl2 & pl3)
End Function

Function nl2br(str)
    If Not isNull(str) Then
        nl2br=replace(str,VbCrLf, "<br >&nbsp; ")
    End If
End function

Function AddZeros(str)

    iLength = len(str)
    iZeros = 9 - iLength

    For i=1 to iZeros

        str = "0" & str

    Next

    AddZeros = "<font color=green><b>AKC-"&str&"</b></font>"

End Function

Function DisplayDateFormat(str)
    arrDate = Split(CStr(str),"/")
    DisplayDateFormat = arrDate(1)&"-"&arrDate(0)&"-"&arrDate(2)

End Function


Function DBDateFormat(str)


End Function

Function doubleQuote(ByVal fixText)
    doubleQuote = Replace(fixText, "'", "''")
End Function

%>

Upvotes: 0

Views: 474

Answers (1)

adzm
adzm

Reputation: 4146

should be

Provider=sqloledb;Network Library=DBMSSOCN;Data Source=xx.xx.xx.xx,1433

note the comma for the explicit port and the Network word.

Though it may be best to just use Data Source=xxxx;

and set up network library specifics via the xxxx alias in cliconfg

Upvotes: 1

Related Questions