File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes best method for faster execution Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "best method for faster execution" Watch "best method for faster execution" New topic

best method for faster execution

Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47
Because of large data, my execution takes long time,
i want to reduce it

what i am doing is adding all the fields in a temporary variable STR
Then calling that in.
like shown below

[changed subject from all caps - this is considered shouting on the internet]
[ February 18, 2008: Message edited by: Jeanne Boyarsky ]

-Rajesh.V<br /> Software Consultant
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

Can you post the query? Many performance issues are in the SQL itself.

Some thoughts:
1) You should use StringBuilder or StringBuffer rather than all those string concats. This is unlikely to be your primary bottleneck, but is still good practice?
2) How many columns are in your select statement? If there are any fields you aren't using, you are transferring more data than necessary.
3) Are you required to display 2000 records on the screen in an HTML table? This seems hard to use on the screen. Can you introduce paging and display a reasonable number at a time.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Rajesh,

-you can use CSS for makeup (instead of a lot of "align=center" in your String)

-your resultpage can look very funny if one if your rs.getString(x) has html, javascript or css code in it. Better use JSTL for this.

-better put your sql-query in a separate class: better for reuse, easier to test.

I agree. Here's the link:
subject: best method for faster execution
jQuery in Action, 3rd edition