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
 
- Create a Standard EXE project with two Command Buttons on the
   new Form.
 - 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
 - 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.
 - Save the Project.
 - Run the Project by pressing F5.
 - Click on the Create Table button (The user database may have to
   be changed in the code to match your setup).
 - 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 
	
	 |