Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle & ASP, connection problem

Re: Oracle & ASP, connection problem

From: Charles Hooper <hooperc2000_at_yahoo.com>
Date: 12 Jul 2006 04:32:08 -0700
Message-ID: <1152703928.129569.42800@p79g2000cwp.googlegroups.com>


caiusmeridius_at_go2.pl wrote:
> Hi!
>
> I've a problem I cannot solve. I'm trying to connect to Oracle using
> ASP, when I try to open connection I get "ORA-12640: Authentication
> adapter initialization failed". I tried to change connection strings,
> OleDB drivers, ODBC drivers, nothing works. Interesting thing is when I
> use ASP.NET everything works fine (unfortunately I can't write the
> whole application in .NET).
> Oracle server version is 8.1.7.0, OS WinXP, P4 processor.
>
> This is the code with the error.
>
> <%@ Language="VBScript" %>
> <% Option Explicit %>
>
> <%
> const CONNECTION_STRING = "Provider=msdaora;Data
> Source=mydatabase;User
> Id=xxx;Password=xxx;"
> const adModeReadWrite = 3
> const adModeRead = 1
> dim objConn
> dim objRecordSet
> %>
> Anybody have any idea?
>
> Greetings
> Rafal

VB strikes again.

This code example uses user names and passwords stored in session variables so that those values can persist between pages.

    Dim snpData
    Dim strSQL
    Dim dbDatabase

    Set dbDatabase = Server.CreateObject("ADODB.Connection")

    dbDatabase.open "Provider=MSDAORA.1;User ID=" & session("Username") & ";Password=" & session("Password") & ";Data Source=MyDatabaseSID;Persist Security Info=True"

    Set snpData = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT" + vbCrLf
    strSQL = strSQL + "  DAC.DEPARTMENT," + vbCrLf
    strSQL = strSQL + "  DECODE(DAC.LAST_NAME,NULL,'Comp
'||SOURCE_COMPUTER,DAC.LAST_NAME||', '||DAC.FIRST_NAME) EMP_NAME," + vbCrLf

    strSQL = strSQL + " ACCESS_DATE," + vbCrLf     strSQL = strSQL + " DECODE(WIL.COMPUTER_NAME,NULL,'<a href=' || CHR(34) || 'http://'||WL.DESTINATION_IP|| CHR(34) || ' target=' || CHR(34) || 'ReportWindow2' || CHR(34) ||'> ' || WL.DESTINATION_IP ||'</A>',WIL.COMPUTER_NAME||' (<a href=' || CHR(34) || 'http://'||WL.DESTINATION_IP|| CHR(34) || ' target=' || CHR(34) || 'ReportWindow2' || CHR(34) ||'> ' || WL.DESTINATION_IP ||'</A>)') SITE" + vbCrLf

    strSQL = strSQL + "FROM" + vbCrLf
    strSQL = strSQL + "  WEB_LOG WL," + vbCrLf
    strSQL = strSQL + "  WEB_IP_LOOKUP WIL," + vbCrLf
    strSQL = strSQL + "  DOC_ADDRESS_CONVERSION DAC" + vbCrLf
    strSQL = strSQL + "WHERE" + vbCrLf
    strSQL = strSQL + "  WL.ACCESS_DATE  BETWEEN '" + varStartDate + "'
AND '" + varEndDate + "'" + vbCrLf

    strSQL = strSQL + " AND WL.DESTINATION_IP=WIL.IP(+)" + vbCrLf     strSQL = strSQL + " AND WL.SOURCE_COMPUTER=DAC.COMPUTER_NAME(+)" + vbCrLf

    strSQL = strSQL + "ORDER BY" + vbCrLf     strSQL = strSQL + " DECODE(DAC.LAST_NAME,NULL,'Comp '||SOURCE_COMPUTER,DAC.LAST_NAME||', '||DAC.FIRST_NAME)," + vbCrLf

    strSQL = strSQL + " ACCESS_DATE"
'Response.Write strSQL

    snpData.open strSQL, dbDatabase
'Use the data here

    snpData.Close
    Set snpData = Nothing
    dbDatabase.Close

Make certain that you have a current version of MDAC (Microsoft Data Access 2.6 or above) installed.

Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc. Received on Wed Jul 12 2006 - 06:32:08 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US