ADOBD execute problem

Discussion in 'ASP General' started by Baba, Jul 2, 2008.

  1. Baba

    Baba Guest

    Hi,
    using ADODB in ASP pages we have this strange problem.

    If we create an ADODB connection specifying the DNS server name instead of
    IP server address, then sometimes, during call to Execute method we get this
    error:

    [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or
    access denied.

    The code looks simply like:

    <%
    Dim cn, rst

    Set cn = Server.CreateObject("ADODB.Connection")
    cn.ConnectionString = "Driver={SQL Server};Server=sql.acme.com;Initial
    Catalog=SomeDB;User Id=...;Password=..."
    cn.Open

    Set rst = cn.Execute("SELECT * FROM SomeTableWHERE ...")
    ....

    rst.Close
    Set rst = Nothing

    cn.Close
    Set cn = Nothing

    %>

    In my opinion, the strange things are:

    1) No problem appears if we specify IP Server address
    2) The problem is on the Execute and not on the cn.Open()
    3) The problema appears sometimes

    We tried to add a line to hosts file too, to avoid use of resolver (in the
    hypotesys of name server problems) but nothing changed: the error still
    happens randomly.

    Unluckly, now we have to use the server name instead of IPAddress for the
    cohexistence of web and windows application from inside/outside LAN area.

    Thank you in advance.
    Baba, Jul 2, 2008
    #1
    1. Advertising

  2. Baba wrote:
    > Hi,
    > using ADODB in ASP pages we have this strange problem.
    >
    > If we create an ADODB connection specifying the DNS server name
    > instead of IP server address, then sometimes, during call to Execute
    > method we get this error:
    >
    > [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not
    > exist or access denied.
    >
    > The code looks simply like:
    >
    > <%
    > Dim cn, rst
    >
    > Set cn = Server.CreateObject("ADODB.Connection")
    > cn.ConnectionString = "Driver={SQL Server};Server=sql.acme.com;Initial
    > Catalog=SomeDB;User Id=...;Password=..."


    It sounds as if you have some network issues. However, you should use the
    native OLE DB provider for SQL Server rather than the obsolete ODBC
    provider. See the section about SQL Server OLE DB connections at
    www.connectionstrings.com

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jul 2, 2008
    #2
    1. Advertising

  3. Baba wrote:
    > Hi,
    > using ADODB in ASP pages we have this strange problem.
    >
    > If we create an ADODB connection specifying the DNS server name
    > instead of IP server address, then sometimes, during call to Execute
    > method we get this error:
    >
    > [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not
    > exist or access denied.


    Like Bob says, use OLEDB. Then force TCP/IP instead of named pipes by
    specifying the network library:
    http://www.connectionstrings.com/article.aspx?article=howtodefinewichnetworkprotocoltouse

    In general, this is very useful:
    http://www.connectionstrings.com/?carrier=sqlserver



    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.
    Dave Anderson, Jul 2, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ravi
    Replies:
    6
    Views:
    461
    Kris Wempa
    Oct 1, 2003
  2. David Berman
    Replies:
    0
    Views:
    1,786
    David Berman
    Jun 22, 2004
  3. sathya
    Replies:
    1
    Views:
    2,774
    John Timney \(ASP.NET MVP\)
    Jun 16, 2005
  4. Mark K

    Execute problem with JCreator

    Mark K, Nov 9, 2004, in forum: Java
    Replies:
    13
    Views:
    3,087
    Andrew Thompson
    Nov 10, 2004
  5. Savas Ates
    Replies:
    1
    Views:
    276
    Patrice
    Aug 17, 2004
Loading...

Share This Page