Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Multiple RowSets redux...

 
   Database Forums (Home) -> Java RSS
Next:  ODBC Errors  
Author Message
mdR

External


Since: Dec 11, 2007
Posts: 14



(Msg. 1) Posted: Tue Jan 29, 2008 7:29 pm
Post subject: Multiple RowSets redux...
Archived from groups: comp>lang>java>databases (more info?)

ok, i think i'm getting a handle on the whole MVC thing and how i
should be constructing my db application. But i am still confused on
one thing. (well probably more, but one for now)

again, i am trying to build an app that displays data from multiple
tables in a single Derby database. the tables will be displayed in
two different JTables with two different TableModels displayed on the
same frame. Each TableModels will get their data from a JDBCRowSet
object. My question is, should each TableModel have it's own
JDBCRowSet instance; which seems the most straight-forward, but
requires multiple connections--or is there a better way-- to somehow
use one connection and retrieve multiple result sets?

btw--this is going to be a multi-user client/server app.

tia
-mark

 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
Lew

External


Since: Aug 30, 2007
Posts: 57



(Msg. 2) Posted: Tue Jan 29, 2008 10:50 pm
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

mdR wrote:
> i [sic] am trying to build an app that displays data from multiple
> tables in a single Derby database. the tables will be displayed in
> two different JTables with two different TableModels displayed on the
> same frame. Each TableModels will get their data from a JDBCRowSet
> object. My question is, should each TableModel have it's [sic] own
> JDBCRowSet instance; which seems the most straight-forward, but

What is the package in which 'JDBCRowSet' resides? The only similarly-named
API type I can find is
<http://java.sun.com/javase/6/docs/api/javax/sql/rowset/JdbcRowSet.html>
but that's not what you said. What is the class you're discussing?

If it is JdbcRowSet, that does not have the ability to be a disconnected
RowSet. (Read the Javadocs.) And you need to be more careful about spelling.
Case counts!

> requires multiple connections--or is there a better way-- to somehow
> use one connection and retrieve multiple result sets?

If you reuse a RowSet, or any ResultSet,
> A ResultSet object is automatically closed when the Statement object
> that generated it is closed, re-executed, or used to retrieve the
> next result from a sequence of multiple results.
<http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html>

This presumably will not affect disconnected RowSets, but the fact remains
that re-using a RowSet for multiple models will be very difficult. Each time
you load it for one TableModel, you somehow would have to get the other
TableModel not to use it, and vice versa. Seems complicated.

--
Lew
The word "I" in English is capitalized. Case counts.

 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
mdR

External


Since: Dec 11, 2007
Posts: 14



(Msg. 3) Posted: Wed Jan 30, 2008 5:40 am
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 29, 9:50 pm, Lew wrote:
> mdR wrote:
> > i [sic] am trying to build an app that displays data from multiple
> > tables in a single Derby database. the tables will be displayed in
> > two different JTables with two different TableModels displayed on the
> > same frame. Each TableModels will get their data from a JDBCRowSet
> > object. My question is, should each TableModel have it's [sic] own
> > JDBCRowSet instance; which seems the most straight-forward, but
>
> What is the package in which 'JDBCRowSet' resides? The only similarly-named
> API type I can find is
> <http://java.sun.com/javase/6/docs/api/javax/sql/rowset/JdbcRowSet.html>
> but that's not what you said. What is the class you're discussing?
>
> If it is JdbcRowSet, that does not have the ability to be a disconnected
> RowSet. (Read the Javadocs.) And you need to be more careful about spelling.
> Case counts!
>
> > requires multiple connections--or is there a better way-- to somehow
> > use one connection and retrieve multiple result sets?
>
> If you reuse a RowSet, or any ResultSet,> A ResultSet object is automatically closed when the Statement object
> > that generated it is closed, re-executed, or used to retrieve the
> > next result from a sequence of multiple results.
>
> <http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html>
>
> This presumably will not affect disconnected RowSets, but the fact remains
> that re-using a RowSet for multiple models will be very difficult. Each time
> you load it for one TableModel, you somehow would have to get the other
> TableModel not to use it, and vice versa. Seems complicated.
>
> --
> Lew
> The word "I" in English is capitalized. Case counts.


Thanks again for the reply... (it was late and I just wanted to get
some answers overnight for today--got lazy on the caps)
I kind of thought re-using a RowSet would be trouble and difficult to
manage. So that answers that.

Yes, I meant JdbcRowSet, and I'm not sure that I want a disconnected
RowSet. It's going to be a fairly large database. It probably won't
be able to load all in memory. Wouldn't I want to use JdbcRowSet?

-mark
 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
mdR

External


Since: Dec 11, 2007
Posts: 14



(Msg. 4) Posted: Wed Jan 30, 2008 5:42 am
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 30, 2:41 am, Dyreatn... RemoveThis @sun.com wrote:
> mdR writes:
> > ok, i think i'm getting a handle on the whole MVC thing and how i
> > should be constructing my db application. But i am still confused on
> > one thing. (well probably more, but one for now)
>
> > again, i am trying to build an app that displays data from multiple
> > tables in a single Derby database. the tables will be displayed in
> > two different JTables with two different TableModels displayed on the
> > same frame. Each TableModels will get their data from a JDBCRowSet
> > object. My question is, should each TableModel have it's own
> > JDBCRowSet instance; which seems the most straight-forward, but
> > requires multiple connections--or is there a better way-- to somehow
> > use one connection and retrieve multiple result sets?
>
> No, connections are not _that_ expensive. In Derby
> the connection is simply a Java thread with an associated socket. It
> doesn't grab huge chunks of memory so it does not add much to the
> footprint either.
>
> Note that in Derby obtaining the first connection (with the create=true
> property) could take some time, because the whole database gets
> created. But getting the next connection to that database will be very
> quick (as will getting a connection to an existing database).
>
> And you should use PreparedStatements for anything where performance is
> important. This is true for most databases, but especially for Derby
> which compiles SQL to java byte code which is a rather heavy
> process.
>
>
>
> > btw--this is going to be a multi-user client/server app.
>
> --
> dt
>
> Questions about Derby/Java DB? Please visithttp://db.apache.org/derby/derby_mail.html

Great! Above combined with Lews comments puts me on the right
track.
And yes, I plan on using PreparedStatements.
Thanks again.

-mark
 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
Dyreatnews

External


Since: Jun 08, 2006
Posts: 23



(Msg. 5) Posted: Wed Jan 30, 2008 7:02 am
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

mdR writes:

> ok, i think i'm getting a handle on the whole MVC thing and how i
> should be constructing my db application. But i am still confused on
> one thing. (well probably more, but one for now)
>
> again, i am trying to build an app that displays data from multiple
> tables in a single Derby database. the tables will be displayed in
> two different JTables with two different TableModels displayed on the
> same frame. Each TableModels will get their data from a JDBCRowSet
> object. My question is, should each TableModel have it's own
> JDBCRowSet instance; which seems the most straight-forward, but
> requires multiple connections--or is there a better way-- to somehow
> use one connection and retrieve multiple result sets?

No, connections are not _that_ expensive. In Derby
the connection is simply a Java thread with an associated socket. It
doesn't grab huge chunks of memory so it does not add much to the
footprint either.

Note that in Derby obtaining the first connection (with the create=true
property) could take some time, because the whole database gets
created. But getting the next connection to that database will be very
quick (as will getting a connection to an existing database).

And you should use PreparedStatements for anything where performance is
important. This is true for most databases, but especially for Derby
which compiles SQL to java byte code which is a rather heavy
process.

>
> btw--this is going to be a multi-user client/server app.

--
dt

Questions about Derby/Java DB? Please visit
http://db.apache.org/derby/derby_mail.html
 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
Lew

External


Since: Aug 30, 2007
Posts: 57



(Msg. 6) Posted: Wed Jan 30, 2008 9:56 am
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

mdR wrote:
> Yes, I meant JdbcRowSet, and I'm not sure that I want a disconnected
> RowSet. It's going to be a fairly large database. It probably won't
> be able to load all in memory. Wouldn't I want to use JdbcRowSet?

I don't know. I've been writing Java JDBC code for nine years and never once
used JdbcRowSet. What are its advantages over regular RowSet or ResultSet?

--
Lew
 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
mdR

External


Since: Dec 11, 2007
Posts: 14



(Msg. 7) Posted: Wed Jan 30, 2008 2:13 pm
Post subject: Re: Multiple RowSets redux... [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 30, 8:56 am, Lew wrote:
> mdR wrote:
> > Yes, I meant JdbcRowSet, and I'm not sure that I want a disconnected
> > RowSet. It's going to be a fairly large database. It probably won't
> > be able to load all in memory. Wouldn't I want to use JdbcRowSet?
>
> I don't know. I've been writing Java JDBC code for nine years and never once
> used JdbcRowSet. What are its advantages over regular RowSet or ResultSet?
>
> --
> Lew

hmm... I see your point. After a little closer reading on the RowSet
and JdbcRowSet API, it appears the use of a JdbcRowSet is not needed.
I'm coming from JBuilder where all the database stuff was "behind the
curtains" and I didn't have to do as much. They had various DB and
GUI beans for different "stores" of data. Then in the latest release
of JBuilder they dropped their database swing components and support,
so now I've got to back up and learn all the stuff under the hood.
Which, I guess, is a good thing. Just running into some confusion,
which you guys are helping straighten out Smile Actually it's becoming
pretty fun!

What happens on extremely large databases? Say, a table that has
50,000 rows and each row has about 16 columns with each column being
char(30). Or is that not that large?

-mark
 >> Stay informed about: Multiple RowSets redux... 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Shared RowSets not in sync after Insert or Delete - The program below illustrates a problem I'm having keeping shared RowSets in sync with each other. The idea behind shared RowSets is that changes in one are supposed to be visible to the other since they share the same memory, but they can have differen...

Creating a TOC in Birt for multiple Birt reports - I have a large number of completed reports. I would like to use the BIRT TOC feature, but I noticed that the TOC seems to only be useful inside a single report. Is this corect or have I missed something. I want to be able to click on TOC and then selec...

multiple update query on one statement and one connection - Hi, I am using Microsoft access for database. i am trying to update the database by using update query by using for loop. bcz table is growable in size in sence column is not fix. here is the code: -- public String Edit_Master_Result_pre(String..

multiple update query on one statement and one connection - Hi, I am using Microsoft access for database. i am trying to update the database by using update query by using for loop. bcz table is growable in size in sence column is not fix. here is the code: -- public String Edit_Master_Result_pre(String..

Multiple web applications, single virtual host - Hello everyone, I am attempting to create access logs on a per web application basis, using a single virtual host in my server.xml file. Here is what I have so far: <Host name="www.mysite.com" autoDeploy="false" deployO...
   Database Forums (Home) -> Java All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]