 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Davisote Guest
|
Posted: Mon Apr 04, 2005 8:10 pm Post subject: How to return a recordset??? |
|
|
Hi.
I'm implementing a client-server application. The client is an applet and
the server is a normal application.
From the applet I send a string with the query and in the server I execute
this query and I get a recordset (and everything is ok). My problem is how
to make my recordset serializable so I can transfer over the net.???
I 've seen some examples, but I can understand how is it?..
Any help???
Thanks.
|
|
| Back to top |
|
 |
Kevin Dean [TeamB] Guest
|
Posted: Tue Apr 05, 2005 1:52 am Post subject: Re: How to return a recordset??? |
|
|
Davisote wrote:
| Quote: | Hi.
I'm implementing a client-server application. The client is an applet
and the server is a normal application.
From the applet I send a string with the query and in the server I
execute this query and I get a recordset (and everything is ok). My
problem is how to make my recordset serializable so I can transfer
over the net.??? I 've seen some examples, but I can understand how
is it?.. Any help???
Thanks.
|
The RecordSet itself is not serializable. You can, however, serialize
the data. Pseudo-code for this is:
Collection records = new ArrayList();
Iterator rsi = myRecordSet.iterator();
while (rsi.hasNext()) {
MyValueObject mvo = new MyValueObject();
// Populate mvo with data from recordset.
// ...
records.add(mvo);
}
You have to make sure that the MyValueObject class is serializable.
The above is the most common technique and should work quite well for
you.
--
Kevin Dean [TeamB]
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
NEW WHITEPAPERS
Team Development with JBuilder and Borland Enterprise Server
Securing Borland Enterprise Server
http://www.datadevelopment.com/papers/index.html
Please see Borland's newsgroup guidelines at
http://info.borland.com/newsgroups/guide.html
|
|
| Back to top |
|
 |
Davisote Guest
|
Posted: Thu Apr 07, 2005 10:29 pm Post subject: Re: How to return a recordset??? |
|
|
Thanks both.
"Paul Nichols (TeamB)" <paul (AT) comp (DOT) net> escribió en el mensaje
news:4254a4dc$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Davisote" <yeses (AT) hotmail (DOT) com> wrote in message
news:42519f4d (AT) newsgroups (DOT) borland.com...
My problem is how
to make my recordset serializable so I can transfer over the net.???
I 've seen some examples, but I can understand how is it?..
RecordSet's as Kevin mentioned is not serializable, nor should it be.
Having
a live resultset that is remotable, would mean some type of locking on the
database itself, which is not something you would want to hold for any
amount of time, while you pass the recordset across the net domain.
Kevin gave you one approach (using a serializable class to hold records),
or
you can opt to use a cachedrowset, which can be used and does not hold
live
connects to the database.
See http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html
and
http://www.onjava.com/pub/a/onjava/2004/06/23/cachedrowset.html
for examples on doing precisely what you wish to do.
|
|
|
| Back to top |
|
 |
Paul Nichols (TeamB) Guest
|
Posted: Fri Apr 08, 2005 3:20 am Post subject: Re: How to return a recordset??? |
|
|
"Davisote" <yeses (AT) hotmail (DOT) com> wrote
My problem is how
| Quote: | to make my recordset serializable so I can transfer over the net.???
I 've seen some examples, but I can understand how is it?..
|
RecordSet's as Kevin mentioned is not serializable, nor should it be. Having
a live resultset that is remotable, would mean some type of locking on the
database itself, which is not something you would want to hold for any
amount of time, while you pass the recordset across the net domain.
Kevin gave you one approach (using a serializable class to hold records), or
you can opt to use a cachedrowset, which can be used and does not hold live
connects to the database.
See http://www.javaworld.com/javaworld/jw-02-2001/jw-0202-cachedrow.html
and
http://www.onjava.com/pub/a/onjava/2004/06/23/cachedrowset.html
for examples on doing precisely what you wish to do.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|