
HELP: VB4.0 / 32Bit Stack fault on CONNECT
I am using VB4.0 / 32bit, and my applications are going well, but
whenever I'm in the VB4.0 development environment, and performing
connect & disconnects , I regularly get stack fault when calling the
oracle object's (Version 2.0). See the attached fragment of code....
It doesn't seem to matter where I call the code from, a button, a
Load() event, the timer - it will run a few times then give the stack
fault message, usually then causes VB to GPF.
I would like to *RELIABLY* be able to do this as it's driving me
bananas - everything *seems* to be OK when the app is compiled into an
EXE, but I'm still not sure...
The stack fault comes from the call to OpenDatabase.
TIA
Paul 'Syd' Smith
'
' Try and open a connection to the given database using
' the given database name and connect string.
'
' Return Values:
'
' 0 - Connected
' Others - Not Connected: Oracle error number
'
Function Connect(ByVal DbaseName As String, ByVal ConnectString As
String) As Long
'Set up an error handler.
On Error GoTo errhandler
'Create the OraSession Object.
If TypeName(glbOraSession) = "Nothing" Then
MsgBox "ERROR: Trying to recreate an open session"
Connect = -1
Exit Function
End If
Set glbOraSession = CreateObject("OracleInProcServer.XOraSession")
If TypeName(glbOraSession) = "Nothing" Then
TRACE "ORACLE.CLS", "Connect", TRC_ORAERR, "Oracle Session
object not created"
End If
'Create the OraDatabase Object by opening a connection to Oracle.
Set glbOraDatabase = glbOraSession.OpenDatabase(DbaseName,
ConnectString, ORADB_DEFAULT)
If TypeName(glbOraDatabase) = "Nothing" Then
TRACE "ORACLE.CLS", "Connect", TRC_ORAERR, "Oracle Database
object not created"
End If
Set glbOraParams = glbOraDatabase.Parameters
Connect = 0
Exit Function
errhandler:
If Err = 28 Then
Debug.Print "Stack fault"
End If
'Check to see if an Oracle error has occurred.
If glbOraSession.LastServerErr <> 0 Then
TRACE.Output "ORACLE.CLS", "Connect", TRC_ORAERR,
glbOraSession.LastServerErrText
Connect = glbOraSession.LastServerErr
Else 'Must be some non-Oracle error
If glbOraDatabase.LastServerErr <> 0 Then
TRACE.Output "ORACLE.CLS", "Connect", TRC_ORAERR,
glbOraDatabase.LastServerErrText
Connect = glbOraDatabase.LastServerErr
Else 'Must be some non-Oracle error
TRACE.Output "ORACLE.CLS", "Connect", TRC_VBERR, Err,
Error(Err)
Connect = Err
End If
End If
TRACE.Output "ORACLE.CLS", "Connect", TRC_ORAERR, "Connect String
= " & ConnectString
Exit Function
End Function
--
Paul Smith
Technical Manager, SDR Systems Ltd
Please change Compuserve.comz to Compuserve.com to respond via Email