BUG: Using ODBCDirect, Transactions and Oracle Causes Hang

Last reviewed: August 5, 1997
Article ID: Q172313
The information in this article applies to:
  • Microsoft Visual Basic Enterprise Edition for Windows, version 5.0

SYMPTOMS

When connecting to an Oracle database using DAO and ODBCDirect, the application hangs when an Insert statement is within a Begin/Commit Transaction and that procedure is called the second time.

CAUSE

This is caused by a known problem in the Microsoft ODBC Driver for Oracle, Msorcl10.dll.

RESOLUTION

To work around this problem the QueryTimeout property of the Connection object must be set to zero (0). Uncomment the following line of code to make the example run without error:

   Cn.QueryTimeout = 0

STATUS

Microsoft has confirmed this to be a problem in the Microsoft ODBC Driver for Oracle, Msorcl10.dll. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Standard EXE project with two Command Buttons on the new Form.

  2. Add this code to the General Declarations Section:

          Option Explicit
          Dim Ws As Workspace
          Dim Cn As Connection
          '
          ' Note that the parameters in the connection string must be changed
          ' to match your configration.
    

          Private Sub Command1_Click()
    
             On Error Resume Next
             MousePointer = vbHourglass
             Cn.Execute "DROP TABLE CODETEST"
             Cn.Execute "CREATE TABLE CODETEST(CODE VARCHAR2(10) NULL)"
             MousePointer = vbNormal
             MsgBox "Table Created"
          End Sub
    
          Private Sub Command2_Click()
          Dim strSQL As String
          Dim Qd As QueryDef
          Dim txtValue As String
    
          txtValue = "abc"
             Ws.BeginTrans
    
             strSQL = "insert into codetest (code) values ('" & txtValue & "')"
             Set Qd = Cn.CreateQueryDef("", strSQL)
             Qd.Execute  'Fails here the second time
             If (Err.Number <> 0) Then
                 MsgBox ("[cmdExecute_Click] - " + Err.Description)
             Else
                 Qd.Close
             End If
    
            Ws.CommitTrans
    
          MsgBox "Click me again and I will crash"
    
          End Sub
    
          Private Sub Form_Load()
          Dim strConn As String
             Command1.Caption = "Create Table"
             Command2.Caption = "Enter Data"
    
             'Replace <data source name>, <user ID>, and <password> with the
             'DSN, user ID, and password for your Oracle system.
    
             strConn = "odbc;dsn=<data source name>; _
             uid=<user ID>;pwd=<password>"
             Set Ws = CreateWorkspace("", "admin", "", dbUseODBC)
             Set Cn = Ws.OpenConnection("", dbDriverNoPrompt, False, strConn)
    
            'Cn.QueryTimeout = 0 ' This is the workaround line of code
    
          End Sub
    
          Private Sub Form_Unload(Cancel As Integer)
             Cn.Close
             Ws.Close
          End Sub
    
    

  3. Change the <data source name>, <user ID>, and <password> in the connect string (strConn) to the DSN, user ID, and password for your Oracle system.

  4. Save the Project.

  5. Run the Project by pressing F5.

  6. Click on the Create Table button (The user database may have to be changed in the code to match your setup).

  7. Click on the Enter Data button. The first time one record is inserted. Clicking on the "Enter Data" button the second time will hang the application. Go into the Task Manager (CNTL, ALT, DELETE) to Exit the app.

Keywords          : VBKBAutomation VBKBRemote
Version           : WINDOWS:5.0
Platform          : WINDOWS
Issue type        : kbbug


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.