ASP Oracle problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mike

    ASP Oracle problem

    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.CreateOb ject("ADODB.Con nection")
    adoConn.Connect ionString = "Driver={Or acle ODBC Driver};"_
    & "Dbq=EMSNTSRVR. WORLD;"_
    & "Uid=username;" _
    & "Pwd=passwo rd"

    adoConn.open
    Dim result
    Set result = Server.CreateOb ject("ADODB.Rec ordset")
    result.ActiveCo nnection = adoConn
    result.Open "SELECT * FROM TALONSA.OPEN_PR OBLEMS", adoConn,
    adOpenStatic

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

    response.write result.RecordCo unt

    result.Close
    adoConn.Close
    %>
  • Turkbear

    #2
    Re: ASP Oracle problem



    Try using a DSN-Less connection ( it is more efficient than the ODBC one)
    <%
    ' Create and establish data connection
    Set objDC = Server.CreateOb ject("ADODB.Con nection")
    objDC.Connectio nTimeout = 15
    objDC.CommandTi meout = 30

    'Code to connect to Oracle Database instance
    objDC.Open "Provider=MSDAO RA.1;Password=s ecret;User ID=username;Dat a Source=yourtnsn amesentry;Persi st Security
    Info=TRUE"
    %>

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

    [color=blue]
    >[/color]

    On 26 Aug 2004 12:36:34 -0700, mike@dogstar1.c om (mike) wrote:
    [color=blue]
    >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.CreateOb ject("ADODB.Con nection")
    >adoConn.Connec tionString = "Driver={Or acle ODBC Driver};"_
    > & "Dbq=EMSNTSRVR. WORLD;"_
    > & "Uid=username;" _
    > & "Pwd=passwo rd"
    >
    >adoConn.open
    >Dim result
    >Set result = Server.CreateOb ject("ADODB.Rec ordset")
    >result.ActiveC onnection = adoConn
    >result.Open "SELECT * FROM TALONSA.OPEN_PR OBLEMS", adoConn,
    >adOpenStatic
    >
    >'While NOT result.EOF
    >' Response.Write result("PROBLEM _SID")
    >'Wend
    >
    >response.wri te result.RecordCo unt
    >
    >result.Close
    >adoConn.Clos e
    >%>[/color]

    Comment

    • Rich

      #3
      RE: ASP Oracle problem

      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:
      [color=blue]
      > 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.CreateOb ject("ADODB.Con nection")
      > adoConn.Connect ionString = "Driver={Or acle ODBC Driver};"_
      > & "Dbq=EMSNTSRVR. WORLD;"_
      > & "Uid=username;" _
      > & "Pwd=passwo rd"
      >
      > adoConn.open
      > Dim result
      > Set result = Server.CreateOb ject("ADODB.Rec ordset")
      > result.ActiveCo nnection = adoConn
      > result.Open "SELECT * FROM TALONSA.OPEN_PR OBLEMS", adoConn,
      > adOpenStatic
      >
      > 'While NOT result.EOF
      > ' Response.Write result("PROBLEM _SID")
      > 'Wend
      >
      > response.write result.RecordCo unt
      >
      > result.Close
      > adoConn.Close
      > %>
      >[/color]

      Comment

      Working...