If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Migration from Interbase to DB2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-22-05, 16:56
rongiul rongiul is offline
Registered User
 
Join Date: Oct 2003
Posts: 10
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
Reply With Quote
  #2 (permalink)  
Old 02-22-05, 17:22
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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.
Reply With Quote
  #3 (permalink)  
Old 02-22-05, 17:44
rongiul rongiul is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 02-22-05, 17:49
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
Reply With Quote
  #5 (permalink)  
Old 02-23-05, 10:24
rongiul rongiul is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On