473,657 Members | 2,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ResultSet cursor is forward_only from remote SQL/PL procedure ?


Problem: java ResultSet cursor from SQL/PL stored-procedure is
FORWARD_ONLY.

Is it possible to have ResultSet cursors from SQL/PL procedures to
scroll forward and backwards? Perhaps I am missing something.

Environment: client UDB 8.1 FP9a on Win32, server UDB 8.1 FP9a on
Solaris 8 (64BIT).

The JDK version on the WinXP client is
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
The ResultSet.previ ous() and the ResultSet.relat ive() throw exceptions
saying
"This method should only be called on ResultSet objects that are
scrollable
(type TYPE_SCROLL_SEN SITIVE, or TYPE_SCROLL_INS ENSITIVE).
If I replace the stored-procedure call by a direct query, then the
ResultSet is scrollable both forward and backwards.
Results Sets from SQL/PL procedures are forward-only (i.e. the
Resultset.Next works fine,
but the ResultSet.relat ive and Resultset.previ ous throw exceptions.

The SQL/PL stored-procedure declares the cursor as
"WITH RETURN TO CLIENT" and also uses "FOR READ ONLY" on the query
and it makes no difference whether it is static or dynamic SQL.

Some more details below:
/* Universal Driver */
Class.forName(" com.ibm.db2.jcc .DB2Driver");
Connection conn = DriverManager.g etConnection("j dbc:db2:ods",
"u450099", PWD);
/**/

Class.forName(" com.ibm.db2.jcc .DB2Driver");
Connection conn = DriverManager.g etConnection("j dbc:db2:ods",
"my_userid" , PWD);

public void doCursor(Connec tion conn) throws Exception {
Statement stmt =
conn.createStat ement(ResultSet .TYPE_SCROLL_IN SENSITIVE,
ResultSet.CONCU R_READ_ONLY);
ResultSet rs = stmt.executeQue ry("call
p_query_msg_exc eptions('owners hip_rule = ''M055C'' ')");
rs.next(); ***** WORKS OK
rs.previous(); ******* THIS THROWS EXCEPTION
System.out.prin tln(rs.getStrin g(1));
rs.close();
stmt.close();
}
Exception Details:
com.ibm.db2.jcc .b.SqlException : This method should only be called on
ResultSet
objects that are scrollable(type TYPE_SCROLL_SEN SITIVE or
TYPE_SCROLL_INS ENSITIVE)
at com.ibm.db2.jcc .b.ad.nb(ad.jav a:3463)
at com.ibm.db2.jcc .b.ad.g(ad.java :1896)
at com.ibm.db2.jcc .b.ad.relative( ad.java:1883)
at ProcTest.doCurs or(ProcTest.jav a:34)
at ProcTest.main(P rocTest.java:10 4)

Dec 7 '05 #1
4 4443
The symptom is identical if the SQL/PL stored procedure runs locally on
Windows,
identical error message when a Java program attempts to use
ResultSet.relat ive()
on the resultset from an SQL/PL procedure.

Does anyone know why there should be a scrolling difference between the
result-set from a stored-procedure and the identical result-set from a
query ?

Dec 8 '05 #2
_l*****@yahoo.c om wrote:
The symptom is identical if the SQL/PL stored procedure runs locally on
Windows,
identical error message when a Java program attempts to use
ResultSet.relat ive()
on the resultset from an SQL/PL procedure.

Does anyone know why there should be a scrolling difference between the
result-set from a stored-procedure and the identical result-set from a
query ?

That's the way it is defined and designed.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Dec 8 '05 #3
Damn! I cannot see that in the docs (yet).

Dec 8 '05 #4
_l*****@yahoo.c om wrote:
Damn! I cannot see that in the docs (yet).

Where do you find scrollable cursor information. A quick serach in
information center points towards CLI, JDBC, ....
can't see SQL Procedures anywhere...

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Dec 8 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
19007
by: Matthew Houseman | last post by:
All, I've created a synonym that points to a package over a database link like so: CREATE SYNONYM API_MYLINK FOR USER.CSAPI_V2@INSTANCE.DOMAIN.COM I've granted execute like so: grant execute on CSAPI_V2 to scott; When I attach to the database in C# using ODP.NET and attempt to
3
13573
by: Jim Garrison | last post by:
I need to create a ResultSet in an Oracle Java Stored Procedure and return it to a PL/SQL caller. I've done quite a bit of research in Oracle's manuals and on the Web, and have found lots of references to going the other direction (PL/SQL passing/returning REF CURSOR to Java), and Java returning an existing ResultSet (obtained from the databse) as a REF CURSOR to PL/SQL. Neither of these is what I'm looking for. My Java stored...
2
13419
by: php newbie | last post by:
I am trying to write a cursor to update certain rows in a particular order as follows: (I need the cursor version, not SQL, as the update logic depends on the order of rows and some other conditions. I removed the Order-By clause from the statement to simplify it; it gives the same error message with or without it.) DECLARE prod_cursor CURSOR FORWARD_ONLY KEYSET FOR SELECT 1 FROM all_products WHERE p_qty = 0 FOR UPDATE
2
10611
by: Twan Kennis | last post by:
Question: How do I pass a returning resultset from a nested Stored Procedure (which opens a cursor including option "WITH RETURN TO CALLER") as a returning resultset from it's own? When I execute the top-level Stored Procedure, it executes succesfully, but without any resultset. ========================================================== CREATE PROCEDURE sp_executesql(sqltxt CLOB(2M))
8
13996
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY STORE_NAME OPEN @RETCUR
12
2184
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: -- Initialize the temp tables............ create procedure myschema.init_ebom_tables ( ) language sql
5
5343
by: szymon.strus | last post by:
Hello I have a VB6 application using classic ado (MDAC 2.8) for connecting ms sql 2000 server. Application uses a lot of server side cursors. Now I want to switch to ms sql 2005 server but I have noticed very serious performance problem. Sql profiler results of execution of following commands: declare @p1 int set @p1=180150131
1
2107
by: Nils | last post by:
I would like to have the SPinner() to return the cursor (cc) to SPouter, which returns it to caller (client). My simple procedures is as follows: CREATE PROCEDURE SPinner () LANGUAGE SQL result sets 1 BEGIN declare cc cursor with return TO CALLER for
0
1559
by: av~ | last post by:
Hi All , I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line Java code.................... CallableStatement stmt3 = EyeHibernateApp.getHibernateSession().connection().prepareCall("{call answers_select_id( ? )}"); stmt3.setString(1,20); stmt3.execute();
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.