× 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.



Thanks Scott, I must miss interpreted the code.

I'll dig more into the cause of the problem that I'm encountering below:

I've a sub-proc with code like this:
JDBC_SetLong(addressSelectPS(connIdx) :1 :piWGINTS.unii);
myRS = JDBC_ExecPrepQry(addressSelectPS(connIdx));
if myRS <> *null;
if jdbc_nextRow(myRS);
myRecExist = *on;
endif;
JDBC_FreeResult(myRS);
endif;


This sub-proc works fine on the first execution. But it get error below
when it is executed on the second time. The error happened when it executes
the JDBC_SetLong(addressSelectPS(connIdx) :1 :piWGINTS.unii).

java.lang.NullPointerException
at java.lang.Throwable.<init>(Throwable.java:181)
at java.lang.RuntimeException.<init>(RuntimeException.java:32)
at java.lang.NullPointerException.<init>(NullPointerException.java:36)
at com.mysql.jdbc.PreparedStatement.set(Unknown Source)
at com.mysql.jdbc.PreparedStatement.setLong(Unknown Source)


The RPG error (joblog) shows this:
Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
Message type . . . . . : Escape
Date sent . . . . . . : 09/08/10 Time sent . . . . . . : 11:16:58

Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure JDBC_SETLO in program SVCPGM/JDBCR4
received
Java exception "java.lang.NullPointerException:" when calling method
"setLong" with signature "(IJ)V" 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


"Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx> wrote in message
news:mailman.6320.1283960007.2619.rpg400-l@xxxxxxxxxxxxxxx
I don't agree with your assessment.

It closes the current statement -- i.e. it releases the database resources
it's currently using, so the database manager will stop processing the SQL
statement that you executed, and free up it's memory.

It doesn't free the PreparedStatement object you created! It doesn't
prevent you from inserting new parameter markers and running it again! It
just closes the previous run so you aren't running BOTH.


On 9/8/2010 9:51 AM, hockchai Lim wrote:
I just did some studying on Scott Klement's JDBC_FreeResult export
procedure. In observing the code, it seems like this procedure not only
closes and frees the ResultSet, it also auto closes and frees the
PreparedStatement object that is associated to the ResultSet.

I've wrote a RPG program that needs to a same PreparedStatment object to
perform different queries using different parameter mark values. So, I
really do not want to free the PreparedStatement object when freeing the
ResultSet. Does anyone know of the best way to handle this?

Thanks






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.