Re: Multiple RowSets redux...
- From: mdR <mrafn@xxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 05:42:14 -0800 (PST)
On Jan 30, 2:41 am, Dyreatn...@xxxxxxx wrote:
mdR <mr...@xxxxxxxxxxx> 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
.
- References:
- Multiple RowSets redux...
- From: mdR
- Re: Multiple RowSets redux...
- From: Dyreatnews
- Multiple RowSets redux...
- Prev by Date: Re: Multiple RowSets redux...
- Next by Date: Re: Multiple RowSets redux...
- Previous by thread: Re: Multiple RowSets redux...
- Index(es):
Relevant Pages
|
|