You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Julia Weaver <dr...@yahoo.com> on 2003/12/23 15:11:38 UTC

how to perform update records faster?

Hi All,

Can someone please tell me how I able to do
update/modify records faster? My user need to
click/select individual records to update in one big
table(or one web page). Since there are so many
records need to update continually, is a way can
perform faster? Someone told me using session and
Arraylist, another person told me using pop-up window,
but I do not know how to use these specifially, can
anyone help me? 

Thanks,

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: how to perform update records faster?

Posted by Kris Schneider <kr...@dotech.com>.
You may want to look into batch updates:

http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/batchupdates.html

Quoting Julia Weaver <dr...@yahoo.com>:

> Andrew, Thanks for your fast response.
> 
> Yes, my user need to edit a whole bunch of records
> (rows), and there might be more than 20, and for each
> update, my code have to call updateRecord method to
> connect to database, and do the following:
> try {
>  stmt = conn.prepareStatement(stringSQL);
>  rs = stmt.executeQuery();
>  while (rs.next()) {
>  
>  ...update record....
> 
>  rs.close();
>  stmt.close();
>  
> ...disconnect database...
> 
> For each record process the code, so the performance
> is very slow...
> 
> Could you please give me more help?
> 
> 
> 
> --- Andrew Hill <an...@gridnode.com>
> wrote:
> > You mean like edit a whole bunch of records (rows)
> > at one go where you dont
> > necessarily know how many there are, etc...?
> > 
> > Take a look at the examples here:
> > http://www.keyboardmonkey.com/next/index.jsp
> > (btw: You didnt really make your problem very clear
> > so I hope this was what
> > you meant)
> > 
> > 
> > 
> > -----Original Message-----
> > From: Julia Weaver
> > [mailto:dreamweaver_y03@yahoo.com]
> > Sent: Tuesday, 23 December 2003 22:12
> > To: Struts Users Mailing List
> > Subject: how to perform update records faster?
> > 
> > 
> > Hi All,
> > 
> > Can someone please tell me how I able to do
> > update/modify records faster? My user need to
> > click/select individual records to update in one big
> > table(or one web page). Since there are so many
> > records need to update continually, is a way can
> > perform faster? Someone told me using session and
> > Arraylist, another person told me using pop-up
> > window,
> > but I do not know how to use these specifially, can
> > anyone help me?
> > 
> > Thanks,

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: how to perform update records faster?

Posted by Andrew Hill <an...@gridnode.com>.
Well if you use a nested bean for each record, then you can present a whole
bunch of records for editing on the same screen, and thus use the same
connection to update them all. (And one obvious optimisation is to only
update records for which the user changed any of the data)

The keyboard monkey tutorials in that link I sent have some good examples of
how to manage the form bean and the JSP to present this to the user.

Not quite sure why the database access should be so slow though. Normally
your average database is pretty quick (certainly for a mere 20 or so
records).

btw: If your project is more than trivially complex you might want to
investigate using some kind of persistence layer such as iBatis or hibernate
or torque or OJB or...
http://www.ibatis.com/
http://hibernate.bluemars.net/
http://db.apache.org/torque/
http://db.apache.org/ojb/
etc...

And if its very complex and enterprise level there is of course EJB
(though EJB is very overrated imho!)

-----Original Message-----
From: Julia Weaver [mailto:dreamweaver_y03@yahoo.com]
Sent: Tuesday, 23 December 2003 22:41
To: Struts Users Mailing List; andrew.david.hill@gridnode.com
Subject: RE: how to perform update records faster?


Andrew, Thanks for your fast response.

Yes, my user need to edit a whole bunch of records
(rows), and there might be more than 20, and for each
update, my code have to call updateRecord method to
connect to database, and do the following:
try {
 stmt = conn.prepareStatement(stringSQL);
 rs = stmt.executeQuery();
 while (rs.next()) {

 ...update record....

 rs.close();
 stmt.close();

...disconnect database...

For each record process the code, so the performance
is very slow...

Could you please give me more help?



--- Andrew Hill <an...@gridnode.com>
wrote:
> You mean like edit a whole bunch of records (rows)
> at one go where you dont
> necessarily know how many there are, etc...?
>
> Take a look at the examples here:
> http://www.keyboardmonkey.com/next/index.jsp
> (btw: You didnt really make your problem very clear
> so I hope this was what
> you meant)
>
>
>
> -----Original Message-----
> From: Julia Weaver
> [mailto:dreamweaver_y03@yahoo.com]
> Sent: Tuesday, 23 December 2003 22:12
> To: Struts Users Mailing List
> Subject: how to perform update records faster?
>
>
> Hi All,
>
> Can someone please tell me how I able to do
> update/modify records faster? My user need to
> click/select individual records to update in one big
> table(or one web page). Since there are so many
> records need to update continually, is a way can
> perform faster? Someone told me using session and
> Arraylist, another person told me using pop-up
> window,
> but I do not know how to use these specifially, can
> anyone help me?
>
> Thanks,
>
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: how to perform update records faster?

Posted by Julia Weaver <dr...@yahoo.com>.
Andrew, Thanks for your fast response.

Yes, my user need to edit a whole bunch of records
(rows), and there might be more than 20, and for each
update, my code have to call updateRecord method to
connect to database, and do the following:
try {
 stmt = conn.prepareStatement(stringSQL);
 rs = stmt.executeQuery();
 while (rs.next()) {
 
 ...update record....

 rs.close();
 stmt.close();
 
...disconnect database...

For each record process the code, so the performance
is very slow...

Could you please give me more help?



--- Andrew Hill <an...@gridnode.com>
wrote:
> You mean like edit a whole bunch of records (rows)
> at one go where you dont
> necessarily know how many there are, etc...?
> 
> Take a look at the examples here:
> http://www.keyboardmonkey.com/next/index.jsp
> (btw: You didnt really make your problem very clear
> so I hope this was what
> you meant)
> 
> 
> 
> -----Original Message-----
> From: Julia Weaver
> [mailto:dreamweaver_y03@yahoo.com]
> Sent: Tuesday, 23 December 2003 22:12
> To: Struts Users Mailing List
> Subject: how to perform update records faster?
> 
> 
> Hi All,
> 
> Can someone please tell me how I able to do
> update/modify records faster? My user need to
> click/select individual records to update in one big
> table(or one web page). Since there are so many
> records need to update continually, is a way can
> perform faster? Someone told me using session and
> Arraylist, another person told me using pop-up
> window,
> but I do not know how to use these specifially, can
> anyone help me?
> 
> Thanks,
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: how to perform update records faster?

Posted by Andrew Hill <an...@gridnode.com>.
You mean like edit a whole bunch of records (rows) at one go where you dont
necessarily know how many there are, etc...?

Take a look at the examples here:
http://www.keyboardmonkey.com/next/index.jsp
(btw: You didnt really make your problem very clear so I hope this was what
you meant)



-----Original Message-----
From: Julia Weaver [mailto:dreamweaver_y03@yahoo.com]
Sent: Tuesday, 23 December 2003 22:12
To: Struts Users Mailing List
Subject: how to perform update records faster?


Hi All,

Can someone please tell me how I able to do
update/modify records faster? My user need to
click/select individual records to update in one big
table(or one web page). Since there are so many
records need to update continually, is a way can
perform faster? Someone told me using session and
Arraylist, another person told me using pop-up window,
but I do not know how to use these specifially, can
anyone help me?

Thanks,

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org