Hi Sai,

many thanks for your response. Actually, I polished the code before publishing to the mailing list. My original code at the position of the error looked like this

if (result != null) {
                if (result.next()) {               
                // breaks with sql-exception: no such row
                String data = result.getString(1);

result.next() at this position always reports an empty ResultSet.



2009/8/17 Sai Pullabhotla <sai.pullabhotla@jmethods.com>
When a ResultSet is produced, the cursor is positioned before the
first row. You must call ResultSet.next() method to move the cursor to
the first row and then the ResultSet.getXXX methods for each column.
Can you verify/confirm if your code is setup to do this?


Sai Pullabhotla

On Sun, Aug 16, 2009 at 5:04 PM, Dominik
Jednoralski<twelve02@googlemail.com> wrote:
> Hi Geeks,
> I'm integrating the derby-database into a JAVA-driven web application. I'm
> new to derby and I have a problem with the execution of a SELECT-statement.
> The returned ResultSet is empty, although the selected row is definitely
> stored.
> The code below works, creates a new table and inserts a dummy row.
> CREATE TABLE gaps (gapId int generated by default as identity,
> MBaseId VARCHAR(256), important INTEGER DEFAULT 0,
> creation TIMESTAMP, lastModified TIMESTAMP)
> INSERT INTO gaps (data) VALUES ('foo')
> At this position, the row is accessible and everything is fine. Later, when
> I want to retrieve this very row via the follwing code, it breaks because
> the ResultSet is empty. The methods are both members of the same class and
> share the connection and statement, which both are class members.
>  ResultSet result = statement.executeQuery("SELECT data "
>                         + "FROM gaps WHERE gapId = 1" );
>             if (result != null) {
>                 // breaks with sql-exception: no such row
>                 String data = result.getString(1);
> Can anyone of you help me with this? I'm pretty confused. Thanks a lot in
> advance =)
> best
> Dominik