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]

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.