Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    1

    Unanswered: ORA-12154: Only from ASP

    W2k professional server IIS 5
    Oracle 8.1.7

    I am getting the following error message while trying to connect to Oracle from ASP.

    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve service name
    /oratest/testora1.asp, line 28

    I am able to connect from sqlplus and from even from a VB client using the same connection parameters.

    My code is
    ------------------------
    Dim objConnection
    Dim objRecordset
    Set objConnection = Server.CreateObject("ADODB.Connection")
    With objConnection

    'Oracle OLE DB provider for oracle
    '.ConnectionString = "Provider=MSDAORA;Data Source=ORCL;" & _
    ' "User ID=scott; Password=tiger;"

    ''Microsoft ODBC for Oracle Driver
    .ConnectionString = "Provider=MSDASQL;" & _
    "DRIVER={Microsoft ODBC for Oracle}; " & _
    "SERVER=Oracle8_dev; UID=scott; PWD=tiger;"


    .Open
    Response.Write "ADO Provider=" & .Provider & "<BR>"
    Set objRecordset = .Execute("SELECT sysdate, user FROM dual")
    End With
    -----------------------

    I tried with both Oracle and MS driver (ODBC) and also OLEDB. I even tried using Oracle Objects. All giving the same error.

    my tnsnames.ora file
    -----
    # TNSNAMES.ORA Network Configuration File: D:\oracle\ora81\NETWORK\ADMIN\tnsnames.ora
    # Generated by Oracle configuration tools.

    ORCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = nishad)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVICE_NAME = ORCL)
    )
    )

    INST1_HTTP =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = nishad)(PORT = 1521))
    )
    (CONNECT_DATA =
    (SERVER = SHARED)
    (SERVICE_NAME = ORCL)
    (PRESENTATION = http://admin)
    )
    )

    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    )
    )
    -------

    Please help...

  2. #2
    Join Date
    Jan 2004
    Posts
    5

    Re: ORA-12154: Only from ASP

    Originally posted by Nishadah
    W2k professional server IIS 5
    Oracle 8.1.7

    I am getting the following error message while trying to connect to Oracle from ASP.

    ...
    This is the same problem I am having. I'd appreciate hearing any possible solutions.

  3. #3
    Join Date
    Dec 2003
    Posts
    3
    TRY IT
    CODE :
    set conn=server.createobject("adodb.connection")
    set rs=server.createobject("adodb.recordset")
    set rs1=server.createobject("adodb.recordset")
    conn.cursorlocation=3
    Rs.CursorType =0
    Rs.CursorLocation=3
    Rs.LockType=1
    conn="Provider=MSDAORA.1;Password=U;User ID=U;Data Source=U;Persist Security Info=True"

  4. #4
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    Hi,

    Verify that a TNSNAMES.ORA file exists and is in the proper place and accessible. See the operating system specific manual for details on the required name and location.

    Check to see that the service name exists in one of the TNSNAMES.ORA files and add it if necessary.

    Make sure there are no syntax errors anywhere in the file. Particularly look for unmatched parentheses or stray characters. Any error in a TNSNAMES.ORA file makes it unusable.

    If possible, regenerate the configuration files using the Oracle Network Manager.
    SATHISH .

  5. #5
    Join Date
    Jan 2004
    Posts
    5
    Originally posted by satish_ct
    Hi,

    Verify that a TNSNAMES.ORA file exists and is in the proper place and accessible. See the operating system specific manual for details on the required name and location.

    Check to see that the service name exists in one of the TNSNAMES.ORA files and add it if necessary.

    Make sure there are no syntax errors anywhere in the file. Particularly look for unmatched parentheses or stray characters. Any error in a TNSNAMES.ORA file makes it unusable.

    If possible, regenerate the configuration files using the Oracle Network Manager.
    Thanks! I ended up having to talk to my db Admin to get a copy of the SQLNET.ORA file also, due to encryption on the system, but you got me started in the right direction when I had no idea where to go.
    I hope this helps the original requestor as much as it did me.
    Thanks again,
    Jim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •