Oracle Insert Issue
Posted: Sat May 14, 2022 1:28 am
For a number of years I have been using the JDBC programs to access Oracle; always as a read-only with a return of a result set.
I am now trying to perform an insert (and an update) to an Oracle table and I am receiving a strange error in the JDBCR4 program.
First, here is the error I am finding in my job log:
Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 05/13/22 Time sent . . . . . . : 17:50:07
Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure JDBC_EXECU in program SLJDBC/JDBCR4 received Java exception "java.sql.SQLException: ORA-00933: SQL command not properly ended█" when calling method "executeUpdate" with signature "(Ljava.lang.String;)I" in class "java.sql.Statement".
Prior to executing the insert statement, I create the connection (successfully) as such:
If OracleConnection = *NULL;
OracleConnection = $LoadJDBCConn(OracleDatabase : OracleConnection);
EndIf;
My SQL statement, in part, looks like this: (I will say, when I run the statement inside of DBeaver (my SQL tool of choice), it executes with no issue)
ExecuteThis = 'INSERT INTO schema.tablename +
(GATEWAY, AIRLINE, AIRBILLNUMBER, +
……..
CREATEUID, CREATETMSTP) +
VALUES +
(Db2_NsiGWAY, Db2_NsiALIN, Db2_NsiABNU, +
……..
HardcodeDBA, SYSDATE);';
My execution of the statement looks as such (it is within here where the error occurs):
OracleRowCountReturn = JDBC_ExecUpd( OracleConnection : ExecuteThis );
Based on what I read of the JDBC_ExecUpd code in the JDBCR4 program, I believe I have it coded correctly.
As I said, the connection is created successfully and the user on Oracle has Insert, Update, Delete, and Select writes against the table in question.
Any thoughts anyone has on this would be very welcomed.
Thanks,
Steve
I am now trying to perform an insert (and an update) to an Oracle table and I am receiving a strange error in the JDBCR4 program.
First, here is the error I am finding in my job log:
Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 05/13/22 Time sent . . . . . . : 17:50:07
Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure JDBC_EXECU in program SLJDBC/JDBCR4 received Java exception "java.sql.SQLException: ORA-00933: SQL command not properly ended█" when calling method "executeUpdate" with signature "(Ljava.lang.String;)I" in class "java.sql.Statement".
Prior to executing the insert statement, I create the connection (successfully) as such:
If OracleConnection = *NULL;
OracleConnection = $LoadJDBCConn(OracleDatabase : OracleConnection);
EndIf;
My SQL statement, in part, looks like this: (I will say, when I run the statement inside of DBeaver (my SQL tool of choice), it executes with no issue)
ExecuteThis = 'INSERT INTO schema.tablename +
(GATEWAY, AIRLINE, AIRBILLNUMBER, +
……..
CREATEUID, CREATETMSTP) +
VALUES +
(Db2_NsiGWAY, Db2_NsiALIN, Db2_NsiABNU, +
……..
HardcodeDBA, SYSDATE);';
My execution of the statement looks as such (it is within here where the error occurs):
OracleRowCountReturn = JDBC_ExecUpd( OracleConnection : ExecuteThis );
Based on what I read of the JDBC_ExecUpd code in the JDBCR4 program, I believe I have it coded correctly.
As I said, the connection is created successfully and the user on Oracle has Insert, Update, Delete, and Select writes against the table in question.
Any thoughts anyone has on this would be very welcomed.
Thanks,
Steve