Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

move cursor backward or absolute by SQL Pass-thru?

4 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-08-18 20:33:29.0Z
Randall Parker Posted on 1997-08-15 14:38:25.0Z
Message-ID: <33F469E1.2410@west.net>
Date: Fri, 15 Aug 1997 10:38:25 -0400
From: Randall Parker <rgparker@west.net>
Reply-To: rgparker_nospam@west.net
X-Mailer: Mozilla 2.02E (OS/2; I)
MIME-Version: 1.0
Subject: move cursor backward or absolute by SQL Pass-thru?
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 22
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:374
Article PK: 252126

The java.sql.ResultSet interface is pretty limited in what it supports
for cursor movement. All one can do is .next().

By contrast, the SQL Anywhere supports NEXT, PRIOR, FIRST, LAST,
ABSOLUTE row-count, RELATIVE row-count.

I want to get the flexibility of SQLA cursor movement while accessing a
database using JDBC. I want to know if there is any way to do this.

Could one do SQL Pass-thru to tell the server to move the cursor? Is
this possible? How? What would the syntax look like?

If it is possible then how to get the client-side driver to put up the
values of the new row? It won't know that what row is current has
changed, would it? Could one use some pass-thru mechanism to move to a
row before the one that you want and then do a ResultSet .next() call to
cause it to go get the values of the row you want?


--


David Lance Wolf Posted on 1997-08-15 21:06:34.0Z
Message-ID: <33F4C4D9.419ADECB@sybase.com>
Date: Fri, 15 Aug 1997 14:06:34 -0700
From: David Lance Wolf <dwolf@sybase.com>
Organization: Sybase Professional Services
X-Mailer: Mozilla 4.01 [en] (Win95; U)
MIME-Version: 1.0
Subject: Re: move cursor backward or absolute by SQL Pass-thru?
X-Priority: 3 (Normal)
References: <33F469E1.2410@west.net>
Content-Type: multipart/mixed; boundary="------------0BC4781A983DCFF1C14EA6B6"
Newsgroups: sybase.public.jdbcconnect
Lines: 63
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:373
Article PK: 252124

Randall-

Alot of people ask for this. Your right, the next() method is the only
one defined in the JDBC API, probobly because its the least common
denominator (note that SQL Server doesn't have dynamic scrollable
cursors like SQL Anywhere does.)

In PowerJ, they've written a nice set of wrapper classes called
JDBCTransaction which has methods like moveFirst(), moveRelative() etc.

You could code a wrapper yourself. Doing something like placing the
result set into a Vector, then making methods to move up and down the
vector, but I dont think this will be trivial.

I'd take a look at PowerJ and its classes. You can get a free demo from
the www.sybase.com site.

Dave Wolf
Sybase Professional Services

Randall Parker wrote:

> The java.sql.ResultSet interface is pretty limited in what it supports
>
> for cursor movement. All one can do is .next().
>
> By contrast, the SQL Anywhere supports NEXT, PRIOR, FIRST, LAST,
> ABSOLUTE row-count, RELATIVE row-count.
>
> I want to get the flexibility of SQLA cursor movement while accessing
> a
> database using JDBC. I want to know if there is any way to do this.
>
> Could one do SQL Pass-thru to tell the server to move the cursor? Is
> this possible? How? What would the syntax look like?
>
> If it is possible then how to get the client-side driver to put up the
>
> values of the new row? It won't know that what row is current has
> changed, would it? Could one use some pass-thru mechanism to move to a
>
> row before the one that you want and then do a ResultSet .next() call
> to
> cause it to go get the values of the row you want?
>
> --


Download VCard vcard.vcf


Randall Parker Posted on 1997-08-15 20:09:08.0Z
Message-ID: <33F4B763.1B77@west.net>
Date: Fri, 15 Aug 1997 16:09:08 -0400
From: Randall Parker <rgparker@west.net>
Reply-To: rgparker_nospam@west.net
X-Mailer: Mozilla 2.02E (OS/2; I)
MIME-Version: 1.0
Subject: Re: move cursor backward or absolute by SQL Pass-thru?
References: <33F469E1.2410@west.net> <33F4C4D9.419ADECB@sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 28
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:371
Article PK: 252123

<<In PowerJ, they've written a nice set of wrapper classes called
JDBCTransaction which has methods like moveFirst(), moveRelative()
etc.>>

In the implementation done in PowerJ will it work against any JDBC
driver? Or will it only work with jdbcConnect?

Does it only work against certain RDBMS's?

In the PowerJ implementation, when the cursor first opens, does the
JDBCTransaction class (or some other class) read all the records from a
cursor over into the client-side?
Or does it read them all over when you pass thru them and then keep
them all buffered up on a client?

A friend has since informed me that Sun's Javasoft site has an example
that loops thru and gets all the primary key fields in all rows in the
cursor, buffering them up, and then query back to get each specific row
as you advance to it in your user interface. See:

http://developer.javasoft.com/developer/readAboutJava/jpg/scrollbars.html

As I understand it, DB2 v5 is going to have dynamically scrollable
cursors but I think this will only be supported for read-only cursors.


--


Eric Giguere Posted on 1997-08-18 20:33:29.0Z
From: "Eric Giguere" <giguere@watcom.com>
Subject: Re: move cursor backward or absolute by SQL Pass-thru?
References: <33F469E1.2410@west.net> <33F4C4D9.419ADECB@sybase.com> <33F4B763.1B77@west.net>
Organization: Sybase, Inc. (Waterloo)
Message-ID: <01bcac26$d93f24a0$9e8c1fac@giguere-pc>
X-Newsreader: Microsoft Internet News 4.70.1161
Newsgroups: sybase.public.jdbcconnect
Date: Mon, 18 Aug 1997 16:33:29 -0400
Lines: 19
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:367
Article PK: 252119


Randall Parker <rgparker@west.net> wrote in article
<33F4B763.1B77@west.net>...
> In the implementation done in PowerJ will it work against any JDBC
> driver? Or will it only work with jdbcConnect?

It works with any JDBC driver.

> Does it only work against certain RDBMS's?

It is independent of the RDBMS and should work with everything.

> In the PowerJ implementation, when the cursor first opens, does the
> JDBCTransaction class (or some other class) read all the records from a
> cursor over into the client-side?
> Or does it read them all over when you pass thru them and then keep
> them all buffered up on a client?

The records are read as needed (as the cursor moves) and cached locally.

Eric