Unix Technical Forum

Re: TYPE_FORWARD_ONLY

This is a discussion on Re: TYPE_FORWARD_ONLY within the Informix forums, part of the Database Server Software category; --> thak you, The problem was in 'else....' I don't put : ResultSet. > TYPE_SCROLL_SENSITIVE, > ResultSet.CONCUR_READ_ONLY than you for ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 10:11 PM
Araujo Guntin
 
Posts: n/a
Default Re: TYPE_FORWARD_ONLY


thak you,

The problem was in 'else....' I don't put :
ResultSet.
> TYPE_SCROLL_SENSITIVE,
> ResultSet.CONCUR_READ_ONLY


than you for all


>From: "Doug Lawry" <lawry@nildram.co.uk>
>Reply-To: "Doug Lawry" <lawry@nildram.co.uk>
>To: informix-list@iiug.org
>Subject: Re: TYPE_FORWARD_ONLY
>Date: Thu, 22 Apr 2004 12:24:58 +0100
>
>1) You need "EXECUTE PROCEDURE" instead of "CALL".
>2) Remove brackets "{" and "}" from the quoted statement.
>3) Use "?" as a place marker for variables.
>4) Specify variables with "pstmt.setString(number,value)".
>
>A full example follows.
>
>Regards,
>Doug Lawry
>www.douglawry.webhop.org
>
>-----------------------------------------------------------------
>
>// Informix JDBC stored procedure demo
>
>// Doug Lawry, 22/04/2004
>
>import java.sql.*;
>
>public class JdbcTest
>{
> static final String jdbc_url =
> "jdbc:informix-sqli://" +
> "YourHost/YourDatabase:" +
> "INFORMIXSERVER=YourServer;" +
> "user=YourLogin;" +
> "password=YourPassword";
>
> static final String sql_code =
> "EXECUTE PROCEDURE YourProcedureName(?)";
>
> static final String sql_data =
> "YourProcedureParameterValue";
>
> public static void main(String[] argv)
> {
> try
> {
> Class.forName("com.informix.jdbc.IfxDriver");
> }
> catch(ClassNotFoundException e)
> {
> System.out.println("Unknown Class: " + e.getMessage());
> return;
> }
> try
> {
> Connection conn = DriverManager.getConnection(jdbc_url);
> PreparedStatement pstmt = conn.prepareStatement(sql_code);
> pstmt.setString(1, sql_data);
> ResultSet r = pstmt.executeQuery();
> while (r.next())
> System.out.println(r.getString(1));
> }
> catch(SQLException e)
> {
> System.out.println("SQL Exception: " + e.getMessage());
> return;
> }
> }
>}
>
>-----------------------------------------------------------------
>
>"Araujo" <araujo_guntin@hotmail.com> 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????
>
>


__________________________________________________ _______________
MSN Amor: busca tu ½ naranja http://latam.msn.com/amor/

sending to informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:17 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com