ASP Oracle problem

Discussion in 'ASP General' started by mike, Aug 26, 2004.

  1. mike

    mike Guest

    Ok, I'll admit I'm VERY new to ASP but I simply cannot seem to get
    this to work. The problem is probably obvious but I just can't seem
    to find it. I'm trying to query an Oracle DB on another server but
    none of my queries seem to work. What happens is that ASP/IIS times
    out. In an effort to see what's really happening, I put the following
    code in to see how many records were being returned by the query. In
    EVERY CASE, the number of records is -1. I've even tried using
    something bulletproof for my query like "SELECT SYSDATE FROM DUAL" I
    know that the query shown here contains the correct table and field
    names. Any help would be greatly appreciated.

    In the following, the ASP/IIS times out if the "While Not..." is left
    UNCOMMENTED. The line to print the recordcount was just added to
    further define the problem.

    <%
    Dim adoConn

    set adoConn = Server.CreateObject("ADODB.Connection")
    adoConn.ConnectionString = "Driver={Oracle ODBC Driver};"_
    & "Dbq=EMSNTSRVR.WORLD;"_
    & "Uid=username;"_
    & "Pwd=password"

    adoConn.open
    Dim result
    Set result = Server.CreateObject("ADODB.Recordset")
    result.ActiveConnection = adoConn
    result.Open "SELECT * FROM TALONSA.OPEN_PROBLEMS", adoConn,
    adOpenStatic

    'While NOT result.EOF
    ' Response.Write result("PROBLEM_SID")
    'Wend

    response.write result.RecordCount

    result.Close
    adoConn.Close
    %>
     
    mike, Aug 26, 2004
    #1
    1. Advertising

  2. mike

    Turkbear Guest

    Try using a DSN-Less connection ( it is more efficient than the ODBC one)
    <%
    ' Create and establish data connection
    Set objDC = Server.CreateObject("ADODB.Connection")
    objDC.ConnectionTimeout = 15
    objDC.CommandTimeout = 30

    'Code to connect to Oracle Database instance
    objDC.Open "Provider=MSDAORA.1;Password=secret;User ID=username;Data Source=yourtnsnamesentry;Persist Security
    Info=TRUE"
    %>

    Also be sure the Oracle client on the IIS server's box is working correctly..


    >


    On 26 Aug 2004 12:36:34 -0700, (mike) wrote:

    >Ok, I'll admit I'm VERY new to ASP but I simply cannot seem to get
    >this to work. The problem is probably obvious but I just can't seem
    >to find it. I'm trying to query an Oracle DB on another server but
    >none of my queries seem to work. What happens is that ASP/IIS times
    >out. In an effort to see what's really happening, I put the following
    >code in to see how many records were being returned by the query. In
    >EVERY CASE, the number of records is -1. I've even tried using
    >something bulletproof for my query like "SELECT SYSDATE FROM DUAL" I
    >know that the query shown here contains the correct table and field
    >names. Any help would be greatly appreciated.
    >
    >In the following, the ASP/IIS times out if the "While Not..." is left
    >UNCOMMENTED. The line to print the recordcount was just added to
    >further define the problem.
    >
    ><%
    >Dim adoConn
    >
    >set adoConn = Server.CreateObject("ADODB.Connection")
    >adoConn.ConnectionString = "Driver={Oracle ODBC Driver};"_
    > & "Dbq=EMSNTSRVR.WORLD;"_
    > & "Uid=username;"_
    > & "Pwd=password"
    >
    >adoConn.open
    >Dim result
    >Set result = Server.CreateObject("ADODB.Recordset")
    >result.ActiveConnection = adoConn
    >result.Open "SELECT * FROM TALONSA.OPEN_PROBLEMS", adoConn,
    >adOpenStatic
    >
    >'While NOT result.EOF
    >' Response.Write result("PROBLEM_SID")
    >'Wend
    >
    >response.write result.RecordCount
    >
    >result.Close
    >adoConn.Close
    >%>
     
    Turkbear, Aug 26, 2004
    #2
    1. Advertising

  3. mike

    Rich Guest

    Could be a few issues:

    1. Sounds like a problem with your TNSNAMES.ORA file on your IIS server.
    From a command prompt, run the Oracle TNSPing utility to see if
    EMSNTSRVR.WORLD resolves properly.

    2. The Oracle client utilites need to be installed on the IIS server. You
    should be able to connect to the Oracle server from the IIS server with SQL+.




    "mike" wrote:

    > Ok, I'll admit I'm VERY new to ASP but I simply cannot seem to get
    > this to work. The problem is probably obvious but I just can't seem
    > to find it. I'm trying to query an Oracle DB on another server but
    > none of my queries seem to work. What happens is that ASP/IIS times
    > out. In an effort to see what's really happening, I put the following
    > code in to see how many records were being returned by the query. In
    > EVERY CASE, the number of records is -1. I've even tried using
    > something bulletproof for my query like "SELECT SYSDATE FROM DUAL" I
    > know that the query shown here contains the correct table and field
    > names. Any help would be greatly appreciated.
    >
    > In the following, the ASP/IIS times out if the "While Not..." is left
    > UNCOMMENTED. The line to print the recordcount was just added to
    > further define the problem.
    >
    > <%
    > Dim adoConn
    >
    > set adoConn = Server.CreateObject("ADODB.Connection")
    > adoConn.ConnectionString = "Driver={Oracle ODBC Driver};"_
    > & "Dbq=EMSNTSRVR.WORLD;"_
    > & "Uid=username;"_
    > & "Pwd=password"
    >
    > adoConn.open
    > Dim result
    > Set result = Server.CreateObject("ADODB.Recordset")
    > result.ActiveConnection = adoConn
    > result.Open "SELECT * FROM TALONSA.OPEN_PROBLEMS", adoConn,
    > adOpenStatic
    >
    > 'While NOT result.EOF
    > ' Response.Write result("PROBLEM_SID")
    > 'Wend
    >
    > response.write result.RecordCount
    >
    > result.Close
    > adoConn.Close
    > %>
    >
     
    Rich, Aug 28, 2004
    #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. vaidas gudas
    Replies:
    1
    Views:
    470
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2004
  2. =?Utf-8?B?TmVv?=
    Replies:
    2
    Views:
    725
    =?Utf-8?B?TWljaGFlbCBCYWx0aWM=?=
    Jul 12, 2005
  3. Benson, John
    Replies:
    1
    Views:
    2,263
    Aurelio Martin
    Jan 28, 2004
  4. Pieter Claerhout
    Replies:
    0
    Views:
    635
    Pieter Claerhout
    Jan 28, 2004
  5. Feyruz
    Replies:
    4
    Views:
    2,338
    Sherm Pendley
    Oct 14, 2005
Loading...

Share This Page