Link to home
Start Free TrialLog in
Avatar of james2432
james2432

asked on

Oracle error occurred, but error message could not be retrieved from Oracle

I have a vb6 application that is trying to connect to a oracle database
my connection string:
"Provider=MSDAORA; Password=test; User ID=test ; Data Source = T; Persist Security Info=True"

I ran a tnsping on T and it works perfectly (and other applications can connect to T)
the error occurs when the connection is opened
On Error GoTo ErrorHandler
    Dim conn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim RS As New ADODB.Recordset
    
    conn.ConnectionString = ConStr
    conn.Open
    
    cmd.ActiveConnection = conn
    cmd.CommandText = "select 1 from test"
    cmd.CommandType = adCmdText
    
    RS.Open cmdCommand
    
    If RS.EOF = False Then
        RS.MoveFirst
        Do
            MsgBox (RS.Fields(0))
        Loop Until RS.EOF = True
        
        RS.Close
    End If
    conn.Close
    
ErrorHandler:
        MsgBox Err.Number & ": " & Err.Description
    Resume Next

Open in new window

Avatar of OMC2000
OMC2000
Flag of Russian Federation image

Try to add error processing, like the following:

ErrorHandler:
MsgBox (conn.Errors(0).Description)

If top level error message is not informative enough,  check all messages in errors collection

Also check if there are several Oracle homes, some of them may have no record for this database in tnsnames.ora
ASKER CERTIFIED SOLUTION
Avatar of james2432
james2432

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I impressed
"saw nothing that really helps"
Avatar of james2432
james2432

ASKER

@OMC2000
by that I mean I had already checked/tried to fix those errors and it amounted to nothing