Problem to connect Oracle from ASP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dounax
    New Member
    • Mar 2008
    • 2

    Problem to connect Oracle from ASP

    Hello,

    I want to connect to an Oracle 9.2 database from a web site.

    - I have created a DSN file, I access the database from Excel
    - I have written the following vbScript, that works:
    Code:
     
    dim rs
    Dim connString
    Dim conn
    Dim SQL
     
    set conn = createobject("ADODB.Connection")
     
    Const DSN = "MonDSN"
    Const UserID = "MonUID"
    Const Password = "MonMdP"
     
    connString="dsn=" + DSN + ";uid=" + UserID + ";pwd=" + Password + ";"
     
    conn.open connString
     
    set rs = conn.execute ("select * from toto")
     
    msgbox(rs.eof)
    conn.close
     
     
    - I have adapted it in ASP:
    <html>
    <body>
    <%
     
    dim rs
    Dim connString
    Dim conn
    Dim SQL
     
    set conn = createobject("ADODB.Connection")
     
    Const DSN = "MonDSN"
    Const UserID = "MonUID"
    Const Password = "MonMdP"
     
    connString="dsn=" + DSN + ";uid=" + UserID + ";pwd=" + Password + ";"
     
    conn.open connString
     
    set rs = conn.execute ("select * from toto")
     
    response.write(rs.eof)
    conn.close
    %>
     
     
    I have the following error:
    Microsoft OLE DB Provider for ODBC Drivers error '80004005' 
    [Microsoft][ODBC driver for Oracle][Oracle]Error while trying to retrieve text for error ORA-12158
    I tried to connect to an SQL Server database using the same method, that works.
    I have read/write rigths on the DSN file (it is placed in web site directory)

    Can somebody help me, please?

    Thanks in advance
    Last edited by DrBunchman; Apr 25 '08, 02:21 PM. Reason: Added code tags - note the # button
  • jeffstl
    Recognized Expert Contributor
    • Feb 2008
    • 432

    #2
    Your DSN may take care of this as I am not sure what is in specified in the DSN file.

    However you will need to at some point refer a provider for the web server to utilize in your connection string

    Provider=OraOLE DB.Oracle

    This is a possibilitiy.

    Comment

    • dounax
      New Member
      • Mar 2008
      • 2

      #3
      Thanks.

      That works with ODBC link 'Oracle dans OraHome92'

      :)

      Comment

      Working...