aspose file tools*
The moose likes JDBC and the fly likes How can i increase the perfomence of jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can i increase the perfomence of jdbc" Watch "How can i increase the perfomence of jdbc" New topic
Author

How can i increase the perfomence of jdbc

siri_suresh
Greenhorn

Joined: Dec 03, 2001
Posts: 2
Hi friends,
I have a que , that que is gettting the data(records) very fastly (updates very fastly).Those records have to be inserted in data base very fastly. prasently it is taking so much time , say for example 3 min per 1000 records. I want with in 20 sec(max). Can we have insert into DB using java that much fastly ? Is there is any technic to improve the performence in jdbc.
Pl suggest me the some way to get this.
Thanking u
Suresh
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

what database/jdbc driver combination are you using?
some huge performance gains can be made using PreparedStatements instead of Statements and Batch updating can also vastly improve performance if utilized correctly.
Jamie
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"siri_suresh",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp .
We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in again with a new name which meets the requirements.
Thanks.
Dave.
siri_suresh
Greenhorn

Joined: Dec 03, 2001
Posts: 2
Hi Jamie , thanks for ur suggision.
I am using Oracle,OCI8 Driver and my table have 60 colomns(max fields are varchar type).
Can u suggist how we can do batch updation.
Thanking u
Suresh Kumar

Originally posted by Jamie Robertson:
what database/jdbc driver combination are you using?
some huge performance gains can be made using PreparedStatements instead of Statements and Batch updating can also vastly improve performance if utilized correctly.
Jamie

Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

in general:
http://java.sun.com/docs/books/tutorial/jdbc/jdbc2dot0/batchupdates.html - these can also be done on PreparedStatements and CallableStatements(if driver supported)
For Oracle: http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/advanced.htm - scroll down to "Batch Update Performance Extension". There is sample code and explanations within the code
In general, Batch Updates work best in some sort of loop:

or something like that
Jamie
Ananya Bhushan
Greenhorn

Joined: Dec 04, 2001
Posts: 5
Hi Suresh!
As u told u are using oci8 driver so driver is not the problem with u.Using prepared or callable statemets can improve performance but it will not be of much help .You can use Batch Updates as per JDBC2.1. Batching large no. of statements can help in significant performance gain.Then one more thing which can help ya is to have a connection pool which will increase the performance considerably .Then if you can use JDBC2.0 u will have the option of using Cashed RowSet which will significantly improve the performance as it caches the rowset on client end till that ResultSet is open.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can i increase the perfomence of jdbc
 
Similar Threads
Best way to access large amount of data using JDBC
Doubt in JavaServerPages and in JavaBeans???
Garbage Collection
Local Connection from Phone to PC
Tomcat not running on windows 7