Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Posts
    10

    Unanswered: Migration from Interbase to DB2

    I am migrating from Interbase to DB2 and I am having some problems with some VB60 code that worked in interbase that doesn't work in DB2.

    DB2 Platform
    Version 7.2
    Fix Pack 11
    Installed on a Windows 2000 server

    My existing code executes a stored procedure "SAVE_TLORDER" thats inputs a parameter. I am also using ADODB

    Private Sub Post_FB_UPDATES(conn As ADODB.Connection, rs As ADODB.Recordset, dtl As Long)
    Dim sqlPost As String
    sqlPost = "EXECUTE PROCEDURE SAVE_TLORDER(" & dtl & ")"
    conn.BeginTrans
    'insert record
    If rs.State <> 0 Then
    rs.Close
    End If
    Set rs = conn.Execute(sqlPost)
    conn.CommitTrans
    End Sub


    It goes without saying that I know nothing about DB2 (Yet).
    Any help is welcome

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by rongiul

    It goes without saying that I know nothing about DB2 (Yet).
    In that case it would help having DB2 SQL reference handy. For example, you'll be able to see that there's no such statement as "EXECUTE PROCEDURE" in DB2.

  3. #3
    Join Date
    Oct 2003
    Posts
    10
    True, but in interbase the syntax to run a stored procedure is:

    Set rs = conn.Execute(" EXECUTE PROCEDURE <stored procedure name and variavle list>")
    conn.CommitTrans

    how do I accomplish this for DB2

    what might help, is if I knew what the syntax was to call or run a procedure from the DB2 Command Center.

    My " EXECUTE PROCEDURE <stored procedure name and variavle list>" worked in the Interbase ISQL window (App to run sql commands) as well as in my VB code.

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    What he is telling you is to look in the SQL Reference manuals to learn how to call a stored procedure in DB2. You will no doubt encounter other such SQL differences that require you to consult the DB2 manuals.

    Look in the Useful DB2 Stuff thread to find links to the DB2 manuals.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Oct 2003
    Posts
    10
    Got it working


    Private Sub Post_FB_UPDATES(conn As ADODB.Connection, rs As ADODB.Recordset, dtl As Long)

    Dim cmd As New ADODB.Command
    Set cmd.ActiveConnection = conn

    'setup stored procedure info to be called
    cmd.CommandText = "SAVE_TLORDER"
    cmd.CommandType = adCmdStoredProc

    'fill in parameter info from stored procedure
    cmd.Parameters.Refresh

    'set up the parameters
    cmd.Parameters("DLID").Value = dtl

    'call the stored procedure
    cmd.Execute

    'release the object
    Set cmd = Nothing


    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •