InstantDB Project
About InstantDB
Project Mail Lists
Short History
Reporting Bugs
Screen Shots
3rd Party Examples
FAQs

Software
Downloads
Documentation
CVS Repositories
Roadmap
License

About Enhydra.org
Who We Are
News, Articles & Events
Getting Involved
Contact Us

Community
Demos
Contributions
Resources
Case Studies
On The Edge! -NEW-
Commercial Vendors


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SV: InstantDB: No Rows Fetched - SQL Exception


Hey

Note that the stmt.close() after your rs = stmt.executequery(sql), this will
close the Resultset and this why you can't make a next on the Resultset.
This is also from the jdbc specs.
And if you want to have two Resultsets open at a time, you should have a new
Statement as the Statement only have one open Resultset at a time (also jdbc
spec).

A other way is to rewrite your query, maybe like this:

SELECT (fwd_bandwidth+bwd_bandwidth) FROM sdr WHERE link_id in (SELECT
link_id FROM link_info)


One could make this in a join, I think it should look something like this:

SELECT (fwd_bandwidth+bwd_bandwidth) FROM sdr,(SELECT link_id FROM
link_info) as T where sdr.link_info=T.link_info


Hope this helps you.

Regrads,
Martin



-----Oprindelig meddelelse-----
Fra: owner-instantDB@enhydra.org [mailto:owner-instantDB@enhydra.org]På
vegne af Johan Stuyts
Sendt: 20. december 2000 08:49
Til: instantDB@enhydra.org
Emne: Re: InstantDB: No Rows Fetched - SQL Exception


I think there are two problems with your code. First you should call
'next()' on
a result set before accessing the first row. You forget to do that with
'rs1'.
Second, InstantDB can only have one result set open at the same time. As you
alredy have 'rs' open, you can't use 'rs1'. Being able to have at most one
result
set open at the same time is compliant with the JDBC specification (although
some
implementations allow multiple result sets to be open). This behaviour is
documented in the InstantDB documentation.

To solve your problem you would have to iterator over all the rows of 'rs'
and
store the data in a container, e.g. 'java.util.Vector'. Then for each item
in the
container execute the nested query.

Johan Stuyts

p singh wrote:

> Hi,
>    I am using instantDb 3.12 version. In my code, I
> execute nested SELECT queries.
> My first query executes the data as expected. But the
> second query throws an
> exception with the message "No rows fetched". SQL code
> = 0 and state = null.
> What causes the instantDB JDBC driver to throw that
> exception. I know there is
> data in the table that I query. I have another sample
> program which retrives the data
> successfully.
> Exception is thrown when it tries to execute rs.next()
> code.
>
> Nested query looks somewhat like this (not the exact
> code)
>
> sql = "SELECT link_id FROM link_info";
> rs = stmt.executequery(sql);
> stmt.close();
>
> try
> {
>    while (rs.next())
>    {
>       sql = "SELECT (fwd_bandwidth+bwd_bandwidth) FROM
> sdr";
>       sql = sql + " WHERE link_id=" + rs.getString(1);
>       rs1 = stmt.executeQuery(sql);
>      System.out.println(rs1.getString(1));
>       rs1.close();
>    }
>  }
>  catch (SQLException se)
> {
>   ....
> }
>
> I appreciate any help.
>
> Cheers,
> Pramod
> Mantra
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
> --------------------------------------------------------------------------
---
> To unsubscribe from this mailing list, send email to majordomo@enhydra.org
> with the text "unsubscribe instantdb" in the body of the email.
> If you have other questions regarding this mailing list, send email to
> the list admin at owner-instantdb@enhydra.org.

----------------------------------------------------------------------------
-
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.

-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.