You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Manjula Kutty <ma...@gmail.com> on 2007/02/06 21:00:01 UTC

CurrentOfTest.java in the client/server mode

While converting the currentof.java I came across this. I thought this test
will be a good candidate to run both on embedded and client/server modes.
But the test passes only on embedded mode. In the client/server mode the
test fails with "junit.framework.ComparisonFailure: Unexpected SQL state.
expected:<24000> but was:<XCL07>" .  The test is doing negative test of
trying to delete cursor past last row caught. In the embedded mode it does
what is expected, but in client/server mode the cursor is getting closed. So
getting a different exception than expected. I ran the old
currentof.javatest in the client/server mode and also got the same
error. So this test is
expected to run only in embedded mode? And this cursor feature is not
implemented in client/server mode?


Thanks
Manjula

Re: CurrentOfTest.java in the client/server mode

Posted by Manjula Kutty <ma...@gmail.com>.
Hi Knut,

Thanks for your clarification. It helps a lot. So for the time being I make
the CurrentOfTest.java to run only in the embedded mode and will open a jira
issue to address the difference in behaviour. If some one fixes that then
they can just uncomment the line specified in the test to make it runnable
in the n/w server mode

Thanks
Manjula


On 2/9/07, Knut Anders Hatlen <Kn...@sun.com> wrote:
>
> Manjula Kutty <ma...@gmail.com> writes:
>
> > Thanks Knut for your clarification. Please bear in mind that I don't
> know
> > much about cursor states. But my strong feeling is that it should behave
> > similar in both embedded and n/w server, other than the difference in
> the
> > SQL states. But please find the attached test (which is a miniature of
> the
> > CurrentOfTest.java), where I expect that cursor.getCursorName() should
> > return null. And it works as expected in the embedded mode. But in N/w
> > server it has a cursor name. Is that the correct behaviour?? If so
> please
> > give me some more inputs..
>
> I'm not sure what's the correct behaviour for getCursorName(). The
> JDBC spec is vague on this issue, but the JDBC API Tutorial and
> Reference, Third Edition says that it should return "the SQL name of
> the cursor associated with this ResultSet object; null if this
> ResultSet object is read-only and its cursor name has not been
> specified with the Statement.setCursorName method". It also says that
> "[if] a DBMS supports positioned update/delete, and if the method
> Statement.setCursorName has not been called to specify a cursor name,
> the JDBC driver or the underlying DBMS must generate a cursor name
> when a SELECT ... FOR UPDATE" statement is executed."
>
> So, according to the tutorial, the embedded driver behaves correctly,
> whereas the network client doesn't.
>
> --
> Knut Anders
>

Re: CurrentOfTest.java in the client/server mode

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Manjula Kutty <ma...@gmail.com> writes:

> Thanks Knut for your clarification. Please bear in mind that I don't know
> much about cursor states. But my strong feeling is that it should behave
> similar in both embedded and n/w server, other than the difference in the
> SQL states. But please find the attached test (which is a miniature of the
> CurrentOfTest.java), where I expect that cursor.getCursorName() should
> return null. And it works as expected in the embedded mode. But in N/w
> server it has a cursor name. Is that the correct behaviour?? If so please
> give me some more inputs..

I'm not sure what's the correct behaviour for getCursorName(). The
JDBC spec is vague on this issue, but the JDBC API Tutorial and
Reference, Third Edition says that it should return "the SQL name of
the cursor associated with this ResultSet object; null if this
ResultSet object is read-only and its cursor name has not been
specified with the Statement.setCursorName method". It also says that
"[if] a DBMS supports positioned update/delete, and if the method
Statement.setCursorName has not been called to specify a cursor name,
the JDBC driver or the underlying DBMS must generate a cursor name
when a SELECT ... FOR UPDATE" statement is executed."

So, according to the tutorial, the embedded driver behaves correctly,
whereas the network client doesn't.

-- 
Knut Anders

Re: CurrentOfTest.java in the client/server mode

Posted by Manjula Kutty <ma...@gmail.com>.
Thanks Knut for your clarification. Please bear in mind that I don't know
much about cursor states. But my strong feeling is that it should behave
similar in both embedded and n/w server, other than the difference in the
SQL states. But please find the attached test (which is a miniature of the
CurrentOfTest.java), where I expect that cursor.getCursorName() should
return null. And it works as expected in the embedded mode. But in N/w
server it has a cursor name. Is that the correct behaviour?? If so please
give me some more inputs..

You can run the test in embedded mode as

java TestCursor embedded

in n/w server ( have to start the server seperately)

java TestCursor NetworkServer

Thanks
Manjula


On 2/7/07, Knut Anders Hatlen <Kn...@sun.com> wrote:
>
> Manjula Kutty <ma...@gmail.com> writes:
>
> > While converting the currentof.java I came across this. I thought this
> test
> > will be a good candidate to run both on embedded and client/server
> modes.
> > But the test passes only on embedded mode. In the client/server mode the
> > test fails with "junit.framework.ComparisonFailure: Unexpected SQL
> state.
> > expected:<24000> but was:<XCL07>" .  The test is doing negative test of
> > trying to delete cursor past last row caught. In the embedded mode it
> does
> > what is expected, but in client/server mode the cursor is getting
> closed. So
> > getting a different exception than expected. I ran the old
> > currentof.javatest in the client/server mode and also got the same
> > error. So this test is
> > expected to run only in embedded mode? And this cursor feature is not
> > implemented in client/server mode?
>
> This sounds like a side effect of DERBY-821. If you move past the last
> row with a forward-only cursor, the cursor will be closed on the
> server. This is an optimization so that the network client doesn't
> have to send a message to the server when it later closes the
> cursor. Apart from the different messages and SQL states, embedded and
> client/server behave the same way in this case, as neither of them
> deletes a row.
>
> --
> Knut Anders
>

Re: CurrentOfTest.java in the client/server mode

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Manjula Kutty <ma...@gmail.com> writes:

> While converting the currentof.java I came across this. I thought this test
> will be a good candidate to run both on embedded and client/server modes.
> But the test passes only on embedded mode. In the client/server mode the
> test fails with "junit.framework.ComparisonFailure: Unexpected SQL state.
> expected:<24000> but was:<XCL07>" .  The test is doing negative test of
> trying to delete cursor past last row caught. In the embedded mode it does
> what is expected, but in client/server mode the cursor is getting closed. So
> getting a different exception than expected. I ran the old
> currentof.javatest in the client/server mode and also got the same
> error. So this test is
> expected to run only in embedded mode? And this cursor feature is not
> implemented in client/server mode?

This sounds like a side effect of DERBY-821. If you move past the last
row with a forward-only cursor, the cursor will be closed on the
server. This is an optimization so that the network client doesn't
have to send a message to the server when it later closes the
cursor. Apart from the different messages and SQL states, embedded and
client/server behave the same way in this case, as neither of them
deletes a row.

-- 
Knut Anders

Re: CurrentOfTest.java in the client/server mode

Posted by Mamta Satoor <ms...@gmail.com>.
Manjula, one place in documentation that we talk about differences between
client/server and embedded is Server and Administration Guide. Not sure if
it talks about any differences wrt cursors.

Mamta


On 2/6/07, Manjula Kutty <ma...@gmail.com> wrote:
>
> Looks like this behaviour is similar. But in my test I'm using the default
> cursor( not sepcifying the cursor type). Also that jira issue is fixed in
> 10.2.1.6.
> Can you please give me some pointer to the documents which says about the
> cursor behaviour difference between the embedded and NetworkServer?
>
> Thanks
> Manjula
>
>
>  On 2/6/07, Mamta Satoor <ms...@gmail.com> wrote:
> >
> > Manjula, may be DERBY-213 (ResultSet.next() after last row of
> > FORWARD_ONLY cursor throws an SQL Exception with Network Server) will help
> > you find an answer about cursor behavior difference between embedded and
> > network server. I haven't spend too much time on it but DERBY-213 sounded
> > like what you are running into.
> >
> > Mamta
> >
> >
> >  On 2/6/07, Manjula Kutty <manjula.kutty@gmail.com > wrote:
> > >
> > > Thanks for the clarification Dan. I'm OK to make this test to run only
> > > in the embedded mode. But still I have this question in my mind. Is the
> > > cursor behaviour different in the client/server mode?
> > >
> > > On 2/6/07, Daniel John Debrunner <djd@apache.org > wrote:
> > > >
> > > > Manjula Kutty wrote:
> > > > > While converting the currentof.java I came across this. I thought
> > > > this
> > > > > test will be a good candidate to run both on embedded and
> > > > client/server
> > > > > modes.
> > > >
> > > > +1 (but see below)
> > > >
> > > > > In the client/server
> > > > > mode the test fails with " junit.framework.ComparisonFailure:
> > > > Unexpected
> > > > > SQL state. expected:<24000> but was:<XCL07>" .  The test is doing
> > > > > negative test of trying to delete cursor past last row caught. In
> > > > the
> > > > > embedded mode it does what is expected, but in client/server mode
> > > > the
> > > > > cursor is getting closed. So getting a different exception than
> > > > > expected. I ran the old currentof.java test in the client/server
> > > > mode
> > > > > and also got the same error. So this test is expected to run only
> > > > in
> > > > > embedded mode? And this cursor feature is not implemented in
> > > > > client/server mode?
> > > >
> > > > I think the test has only run previously in embedded since it is
> > > > only
> > > > listed in derbylang.runall. That suite is not run in any network
> > > > server
> > > > mode.
> > > >
> > > > As part of conversion I think the minimum is to ensure that the same
> > > >
> > > > coverage is achieved, having this test run only in embedded matches
> > > > that
> > > > (since it only ran embedded before). Making it also run in
> > > > client/server
> > > > is not required, but if not done I think an issue should be entered
> > > > to
> > > > say that the test should be expanded to run in client/server (&
> > > > why).
> > > >
> > > > Dan.
> > > >
> > > >
> > > >
> > >
> >
>

Re: CurrentOfTest.java in the client/server mode

Posted by Manjula Kutty <ma...@gmail.com>.
Looks like this behaviour is similar. But in my test I'm using the default
cursor( not sepcifying the cursor type). Also that jira issue is fixed in
10.2.1.6.
Can you please give me some pointer to the documents which says about the
cursor behaviour difference between the embedded and NetworkServer?

Thanks
Manjula


On 2/6/07, Mamta Satoor <ms...@gmail.com> wrote:
>
> Manjula, may be DERBY-213 (ResultSet.next() after last row of FORWARD_ONLY
> cursor throws an SQL Exception with Network Server) will help you find an
> answer about cursor behavior difference between embedded and network server.
> I haven't spend too much time on it but DERBY-213 sounded like what you are
> running into.
>
> Mamta
>
>
>  On 2/6/07, Manjula Kutty <ma...@gmail.com> wrote:
> >
> > Thanks for the clarification Dan. I'm OK to make this test to run only
> > in the embedded mode. But still I have this question in my mind. Is the
> > cursor behaviour different in the client/server mode?
> >
> > On 2/6/07, Daniel John Debrunner <djd@apache.org > wrote:
> > >
> > > Manjula Kutty wrote:
> > > > While converting the currentof.java I came across this. I thought
> > > this
> > > > test will be a good candidate to run both on embedded and
> > > client/server
> > > > modes.
> > >
> > > +1 (but see below)
> > >
> > > > In the client/server
> > > > mode the test fails with " junit.framework.ComparisonFailure:
> > > Unexpected
> > > > SQL state. expected:<24000> but was:<XCL07>" .  The test is doing
> > > > negative test of trying to delete cursor past last row caught. In
> > > the
> > > > embedded mode it does what is expected, but in client/server mode
> > > the
> > > > cursor is getting closed. So getting a different exception than
> > > > expected. I ran the old currentof.java test in the client/server
> > > mode
> > > > and also got the same error. So this test is expected to run only in
> > > > embedded mode? And this cursor feature is not implemented in
> > > > client/server mode?
> > >
> > > I think the test has only run previously in embedded since it is only
> > > listed in derbylang.runall. That suite is not run in any network
> > > server
> > > mode.
> > >
> > > As part of conversion I think the minimum is to ensure that the same
> > > coverage is achieved, having this test run only in embedded matches
> > > that
> > > (since it only ran embedded before). Making it also run in
> > > client/server
> > > is not required, but if not done I think an issue should be entered to
> > >
> > > say that the test should be expanded to run in client/server (& why).
> > >
> > > Dan.
> > >
> > >
> > >
> >
>

Re: CurrentOfTest.java in the client/server mode

Posted by Mamta Satoor <ms...@gmail.com>.
Manjula, may be DERBY-213 (ResultSet.next() after last row of FORWARD_ONLY
cursor throws an SQL Exception with Network Server) will help you find an
answer about cursor behavior difference between embedded and network server.
I haven't spend too much time on it but DERBY-213 sounded like what you are
running into.

Mamta


On 2/6/07, Manjula Kutty <ma...@gmail.com> wrote:
>
> Thanks for the clarification Dan. I'm OK to make this test to run only in
> the embedded mode. But still I have this question in my mind. Is the cursor
> behaviour different in the client/server mode?
>
> On 2/6/07, Daniel John Debrunner <dj...@apache.org> wrote:
> >
> > Manjula Kutty wrote:
> > > While converting the currentof.java I came across this. I thought this
> > > test will be a good candidate to run both on embedded and
> > client/server
> > > modes.
> >
> > +1 (but see below)
> >
> > > In the client/server
> > > mode the test fails with " junit.framework.ComparisonFailure:
> > Unexpected
> > > SQL state. expected:<24000> but was:<XCL07>" .  The test is doing
> > > negative test of trying to delete cursor past last row caught. In the
> > > embedded mode it does what is expected, but in client/server mode the
> > > cursor is getting closed. So getting a different exception than
> > > expected. I ran the old currentof.java test in the client/server mode
> > > and also got the same error. So this test is expected to run only in
> > > embedded mode? And this cursor feature is not implemented in
> > > client/server mode?
> >
> > I think the test has only run previously in embedded since it is only
> > listed in derbylang.runall. That suite is not run in any network server
> > mode.
> >
> > As part of conversion I think the minimum is to ensure that the same
> > coverage is achieved, having this test run only in embedded matches that
> > (since it only ran embedded before). Making it also run in client/server
> > is not required, but if not done I think an issue should be entered to
> > say that the test should be expanded to run in client/server (& why).
> >
> > Dan.
> >
> >
> >
>

Re: CurrentOfTest.java in the client/server mode

Posted by Manjula Kutty <ma...@gmail.com>.
Thanks for the clarification Dan. I'm OK to make this test to run only in
the embedded mode. But still I have this question in my mind. Is the cursor
behaviour different in the client/server mode?

On 2/6/07, Daniel John Debrunner <dj...@apache.org> wrote:
>
> Manjula Kutty wrote:
> > While converting the currentof.java I came across this. I thought this
> > test will be a good candidate to run both on embedded and client/server
> > modes.
>
> +1 (but see below)
>
> > In the client/server
> > mode the test fails with " junit.framework.ComparisonFailure: Unexpected
> > SQL state. expected:<24000> but was:<XCL07>" .  The test is doing
> > negative test of trying to delete cursor past last row caught. In the
> > embedded mode it does what is expected, but in client/server mode the
> > cursor is getting closed. So getting a different exception than
> > expected. I ran the old currentof.java test in the client/server mode
> > and also got the same error. So this test is expected to run only in
> > embedded mode? And this cursor feature is not implemented in
> > client/server mode?
>
> I think the test has only run previously in embedded since it is only
> listed in derbylang.runall. That suite is not run in any network server
> mode.
>
> As part of conversion I think the minimum is to ensure that the same
> coverage is achieved, having this test run only in embedded matches that
> (since it only ran embedded before). Making it also run in client/server
> is not required, but if not done I think an issue should be entered to
> say that the test should be expanded to run in client/server (& why).
>
> Dan.
>
>
>

Re: CurrentOfTest.java in the client/server mode

Posted by Daniel John Debrunner <dj...@apache.org>.
Manjula Kutty wrote:
> While converting the currentof.java I came across this. I thought this 
> test will be a good candidate to run both on embedded and client/server 
> modes.

+1 (but see below)

> In the client/server 
> mode the test fails with " junit.framework.ComparisonFailure: Unexpected 
> SQL state. expected:<24000> but was:<XCL07>" .  The test is doing 
> negative test of trying to delete cursor past last row caught. In the 
> embedded mode it does what is expected, but in client/server mode the 
> cursor is getting closed. So getting a different exception than 
> expected. I ran the old currentof.java test in the client/server mode 
> and also got the same error. So this test is expected to run only in 
> embedded mode? And this cursor feature is not implemented in 
> client/server mode?

I think the test has only run previously in embedded since it is only 
listed in derbylang.runall. That suite is not run in any network server 
mode.

As part of conversion I think the minimum is to ensure that the same 
coverage is achieved, having this test run only in embedded matches that 
(since it only ran embedded before). Making it also run in client/server 
is not required, but if not done I think an issue should be entered to 
say that the test should be expanded to run in client/server (& why).

Dan.