Java RPGLE & Oracle messages
Last Post 07 Jun 2012 09:45 AM by Bryan Leaman. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
peter.metsopulos@cussys.com
New Member
New Member

--
04 May 2012 01:26 PM

I have an RPGLE program connecting to an Oracle database and processing records on an iseries.

I used Scot Klements service program and binding directory stuff and it works great.

He suggests getting help from someone who has interfaces with Oracle in this way.

This is all new to me.

I need to update the Oracle view (Column UPLD to a ‘Y’ so the records fall out)

I need to update each Oracle record but only at the end of the read loop.

 

I have tried to update two ways:  with and without “ around Licplt which is a field being used in the program.

I did it this way to control each row. There should only be one license plate (from_lic)  and I made it match my work field.

 

Below is the Java error and my code.

So close…

 

Thanks,

 

Pete

 

                              Display Spooled File                             

 File  . . . . . :   QPJOBLOG                         Page/Line   3/21         

 Control . . . . .   W+10                             Columns     41 - 118     

 Find  . . . . . .                                                             

 ....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+...

 tement . . . . . . . . . :   20                                               

 module . . . . . . . . . :   JDBCR4                                           

 procedure  . . . . . . . :   JDBC_EXECUPD                                     

 tement . . . . . . . . . :   3084                                             

 sage . . . . :   Java exception received when calling Java method.            

 se . . . . . :   RPG procedure JDBC_EXECU in program PMETSOPULO/JDBCR4        

 eceived Java exception "java.sql.SQLException: ORA-00904: "licplt": invalid   

 dentifier " when calling method "executeUpdate" with signature                

 (Ljava.lang.StringI" in class "java.sql.Statement". Recovery  . . . :       

 ontact the person responsible for program maintenance to determine the        

 ause of the problem. Technical description . . . . . . . . :   If the         

 xception indicates that the Java class was not found, ensure the class for    

 he method is in the class path. If the exception indicates that the Java      

 ethod was not found, check the method name and signature. If the signature    

 s not correct, change the RPG prototype for the method, or change the Java    

 ethod, so that the return type and parameter types match. You can determine   

                                                                        More...

 F3=Exit   F12=Cancel   F19=Left   F20=Right   F24=More keys                   

                                                                                

 

Columns . . . :    6  76           Browse                 PMETSOPULO/QRPGLESRC

 SEU==>                                                                JFPWMS08

 FMT ** ... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+.

0141.00     rs = JDBC_ExecQry(conn: 'Select ord_no, +                          

0142.00                                from_item, +                            

0143.00                                from_lic, +                             

0144.00                                from_each, +                             

0145.00                                from_exp_dt, +                          

0146.00                                upld +                                  

0147.00                                from sonica.v_host_ship_info +          

0148.00                                order by ord_no, from_item, from_lic'); 

0149.00                                                                        

0150.00     dow (jdbc_nextRow(rs));                                             

0151.00         ord_no = jdbc_getCol(rs: 1);                                   

0152.00         from_item = jdbc_getCol(rs: 2);                                

0153.00         from_lic = jdbc_getCol(rs: 3);                                 

0154.00         from_each = jdbc_getCol(rs: 4);                                

0155.00         from_exp_dt = jdbc_getCol(rs: 5);                              

0156.00         upld = jdbc_getCol(rs: 6);                                     

0157.00         eval      licplt = from_lic;      

 

0264.00     // Update Oracle on each Read                                

0265.00                                                                  

0266.00     count = JDBC_ExecUpd(conn:'update sonica.v_host_ship_info +  

0267.00                                set upld = "Y" +                  

0268.00                                where from_lic = "licplt"');      

0269.00     enddo;                                                       

 

               

             

                                                                                

 F3=Exit   F5=Refresh   F9=Retrieve   F10=Cursor   F11=Toggle   F12=Cancel     

 F16=Repeat find        F24=More keys                                          

                                                                                

Bryan Leaman
Veteran Member
Veteran Member
Posts:1745
Avatar

--
07 Jun 2012 09:45 AM

I don't have experience with Oracle, but I suspect the issue might be double-quotes in your update statement. String constants need to be enclosed in single quotes. Since it's an RPG program, you need to use 2 single quotes to embed a single quote in a string. 

Also, since "licplt" is a field in your program, you'll either need to use a prepared statement with a parameter marker (?) or embed the value into the statement.

The correct statement embedding the value should look like this, I believe:

0266.00     count = JDBC_ExecUpd(conn:'update sonica.v_host_ship_info +  
0267.00                          set upld = ''Y'' +                  
0268.00                          where from_lic = ''' + licplt + ''' ');  

--Bryan
You are not authorized to post a reply.

Acceptable Use Policy