TYPE_FORWARD_ONLY
Posted in 2004
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Jobs, Consulting & Announcements
shouldn't it be execute procedure instead of call, but I don't do
Java
Araujo wrote:
>
> Hi everybody...
>
> I have the following stored procedure:
>
> create procedure sp_select_tticu()
> returning integer, char(50) ;> define p_coditicu integer ;
> define p_nombticu char(50);
>
> foreach
> select coditicu, nombticu
> into p_coditicu, p_nombticu
> from tticu
> return p_coditicu, p_nombticu with resume ;>
> end foreach;
> end procedure
>
> ..and I use it from JDBC, with following code:
>
> public Object[][] select(String coditicu) {
> valoresSeleccionados = coditicu;
> PreparedStatement pstmt;
>
> Object[][] selectCodiNomb = null;
>
> try {
> if (coditicu != null) {
> pstmt = Connect.conn.prepareStatement(
> "{call sp_coditicu(" + coditicu + ")};", ResultSet.
> TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_READ_ONLY
> );
> }
> else {
> pstmt = Connect.conn.prepareStatement(
> "{call sp_select_tticu()};");
> }
> ResultSet r = pstmt.executeQuery();
>
> r.last();
> int numberOfRecords = r.getRow();
> selectCodiNomb = new String[numberOfRecords][2];
> r.beforeFirst();
>
> int i = 0;
> while (r.next()) {
> selectCodiNomb[i][0] = r.getString(1);
> selectCodiNomb[i][1] = r.getString(2);
> i++;
> }
> r.close();
> pstmt.close();
> return selectCodiNomb;
> }
> catch (SQLException e) {
> System.out.println("FAILED: Prepare select(String coditicu) failed: "
> +
> e.getErrorCode());
> }
> return selectCodiNomb;
> }
>
> and I have the error:
> FAILED: Prepare select(String coditicu) failed: -79767
>
> because ResultSet Type is TYPE_FORWARD_ONLY, according to database messages.
>
> What can I do????
>
> Thank you?
>
> sending to informix-list
--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #
Hi everybody...
I have the following stored procedure:
create procedure sp_select_tticu()
returning integer, char(50) ; define p_coditicu integer ;
define p_nombticu char(50);
foreach
select coditicu, nombticu
into p_coditicu, p_nombticu
from tticu
return p_coditicu, p_nombticu with resume ;
end foreach;
end procedure
..and I use it from JDBC, with following code:
public Object[][] select(String coditicu) {
valoresSeleccionados = coditicu;
PreparedStatement pstmt;
Object[][] selectCodiNomb = null;
try {
if (coditicu != null) {
pstmt = Connect.conn.prepareStatement(
"{call sp_coditicu(" + coditicu + ")};", ResultSet.
TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_READ_ONLY
);
}
else {
pstmt = Connect.conn.prepareStatement(
"{call sp_select_tticu()};");
}
ResultSet r = pstmt.executeQuery();
r.last();
int numberOfRecords = r.getRow();
selectCodiNomb = new String[numberOfRecords][2];
r.beforeFirst();
int i = 0;
while (r.next()) {
selectCodiNomb[i][0] = r.getString(1);
selectCodiNomb[i][1] = r.getString(2);
i++;
}
r.close();
pstmt.close();
return selectCodiNomb;
}
catch (SQLException e) {
System.out.println("FAILED: Prepare select(String coditicu) failed: "
+
e.getErrorCode());
}
return selectCodiNomb;
}
and I have the error:
FAILED: Prepare select(String coditicu) failed: -79767
because ResultSet Type is TYPE_FORWARD_ONLY, according to database messages.
What can I do????
Thank you?
sending to informix-list