× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am using the JDBC_prepStmt(), JDBC_set*(), and JDBC_execPrepUpd() methods,
and I am running into an error. It appears to be related to parm#96. My
question is first of all, is there a maximum number of parameters that can
be used in a prepared statement? I am using 97, and the prepared statement
is as follows:

d StmtTxt s 234a inz('INSERT INTO
hsplog.dbo.loglistp-
d f1
VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,-
d
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,-
d
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,-
d
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,-
d
?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,-
d ?,?,?,?,?,?,?,?,?,?,?,?')

The statement prepares okay, and returns a non-null prepared statement. All
of the JDBC_set method calls work (no errors), but I get the following error
when I run the JDCB_execPrepUpd() method, accompanied by a return value of
-1:

Additional Message
Information


Message ID . . . . . . : RNX0301 Severity . . . . . . . :
50
Message type . . . . . :
Escape
Date sent . . . . . . : 03/26/08 Time sent . . . . . . :
12:40:44


Message . . . . : Java exception received when calling Java
method.
Cause . . . . . : RPG procedure JDBC_EXECP in program DMART/JDBCR4
received
Java exception "java.sql.SQLException: Incorrect syntax near '@P96'."
when
calling method "executeUpdate" with signature "()I" in
class
"java.sql.PreparedStatement".

Recovery . . . : Contact the person responsible for program maintenance
to
determine the cause of the
problem.
Technical description . . . . . . . . : If the exception indicates that
the
Java class was not found, ensure the class for the method is in the
class
path. If the exception indicates that the Java method was not found,
check
the method name and signature. If the signature is not correct, change
the
RPG prototype for the method, or change the Java method, so that the
return
type and parameter types match. You can determine the signatures for all the
methods in class XYZ using command QSH CMD('javap -s XYZ').

If the '@P96' reference in the message is referring to parm 96, it is a
smalldatetime column in the destination table. My next question is this:
If a column I am trying to populate is a smalldatetime on an SQL server,
Would I use setTimeStamp? I wrote a quick proc to turn a date field into a
timestamp, as follows:

p MakeTS b
d MakeTS pi z
d DateField d const
d TSHolder s z
d TSString s 26a
/free
TSString=%char(DateField:*ISO)+'-00.00.00.000000';
TSHolder=%timestamp(TSString);
return TSHolder;
/end-free
p MakeTS e

and I use the result of the MakeTS() call in the JDBC_setTimestamp() call.
I tried using a JDBC_setDate() call, and got the same error, so I set it
back to a JDBC_setTimestamp() call.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.