This article illustrates the best practices to improve the performance of Daffodil DB / One$DB JDBC Driver. This article focuses on how to improve the performance of a Daffodil DB / One$DB JDBC application using Statement, PreparedStatemnt, CallableStatement and ResultSet interfaces. Choosing the right statement interfaces and right methods according to your SQL query plays a vital role in improving the performance of a JDBC Driver.
JDBC Overview
JDBC API provides standard set of interfaces to work with databases like Daffodil DB / One$DB, Oracle, Derby etc.
Connection interface encapsulates database connection functionality, Statement interface encapsulates SQL statement representation and execution functionality whereas ResultSet interface encapsulates retrieving data which comes from the execution of a SQL query using Statement.
Following are the basic steps to write a JDBC program.
1. Import "java.sql" and "javax.sql" packages. (Import "javax.sql", if advanced JDBC feature like XA is to be used)
2. Load Daffodil DB JDBC driver (embedded or network JDBC Driver)
3. Establish connection to database using Connection interface
4. Create a Statement
5. Execute the Statement
6. Retrieve results by using ResultSet interface
7. Close Statement and Connection
Choosing right Statement interface:
There are three types of Statement interfaces in JDBC to represent/execute a SQL query-Statement, PreparedStatement and CallableStatement. Statement is used for executing static SQL statement with no input and output parameters; PreparedStatement is used to execute dynamic SQL statement with input parameters whereas CallableStatement is used to execute dynamic SQL with both input and output parameters. One important thing to note about PreparedStatement and CallableStatement is that they can also be used for static SQL statements. However, CallableStatement is mainly meant for stored procedures.
PreparedStatement gives better performance when compared to Statement because it is pre-parsed and pre-compiled. This means that compilation and parsing of such statement is done only once by the database. Afterwards the database reuses the already parsed and compiled statement. This significantly improves the performance because whenever a statement has to be executed repeatedly, it doesn't need to be parsed and compiled time and again. So the overload incurred by parsing and compiling the same statement can be reduced.
When there is a requirement for single request to process multiple complex statements, CallableStatement gives better performance as compared to PreparedStatement and Statement.
To read the full article please visit http://www.daffodildb.com/daffodildb-performance-tuning.html
This article has been contributed by (Mr.) Parveen Aggarwal, Technical Consultant to DSL India (http://www.daffodildb.com). With more than 6 years of industry experience in Java and allied technologies, he has an in-depth understanding of J2EE, J2ME and database management systems. Parveen is currently working on the concept of data-archiving in embedded databases. He can be contacted at http://www.daffodildb.com
Benton shuttle to Midway .. Lockport Chicago limo O’HareMidsize business or non-profit organization should decide if one-vendor solution... Read More
Internet worms. Is your PC infected?If your computer has become... Read More
Just stress testing one of the latest Linux distributions. Been... Read More
If you are in a business that passes documents around... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
Microsoft Great Plains and Microsoft Retail Management System (Microsoft RMS)... Read More
Costs of fleet maintenance software can vary widely. It is... Read More
Lotus Domino/Notes ? Microsoft Great Plains tandem as ERP with... Read More
ERP is the acronym of Enterprise Resource Planning. Multi-module ERP... Read More
Executive SummaryAn effective plan for entering, cleaning and updating the... Read More
Linux essentials:It's free for download but you have to pay... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
Every day millions of new web documents emerge on the... Read More
Shareware is software that you can try before you buy;... Read More
Spyware is software or hardware installed on a computer without... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
As Mozilla Firefox nears 10% market share, with well over... Read More
Scrapbooks are very popular these days. I think that almost... Read More
MSN messenger is a pretty cool invention. I mean I'm... Read More
Now that spyware is the single most dangerous threat to... Read More
What is IRC?IRC is Internet Relay Chat. It is a... Read More
Are you ready? SQL Server 2005, the next-generation data management... Read More
Microsoft Business Solutions Great Plains is Dexterity-written application and currently... Read More
We are in a transition phase in the Managerial Administration... Read More
When you own a small business, time is money. And... Read More
limousine Chicago airport Arthur ..Microsoft Great Plains fits to majority of horizontals and retail... Read More
Microsoft CRM is relatively new player on the now becoming... Read More
Document Manager and Version HistoryIn previous articles I have discussed... Read More
Does Microsoft Have any Real Competition? Copyright (c) 2003 Gregory... Read More
While several preventive maintenance software manufacturers offer free trials for... Read More
The fact that a software tester is a most infamous... Read More
Microsoft Business Solutions Great Plains fits to majority of horizontal... Read More
What is Tripwire?Tripwire is a form intrusion detection system (IDS)... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
GroupwareThe internet is full of 1.5 million to 7 million... Read More
If you have Great Plains Dynamics/eEnterprise (version 6.0 or earlier)... Read More
What is Software?Software is a set of instruction written to... Read More
For a windows user like me, just can watch with... Read More
What is RAID RECOVERY?RAID stands for Redundant Array of Inexpensive... Read More
It is possible that if one avoided all sources of... Read More
Microsoft Business Solutions Great Plains is very popular ERP platform... Read More
Microsoft Business Solutions ? Great Plains has captured the US... Read More
Crystal Reports is the most flexible tool on the market... Read More
New post-recession era has new features, which didn't exist in... Read More
Microsoft Great Plains is one of the Microsoft Business Solutions... Read More
Microsoft Great Plains is becoming more and more popular and... Read More
It is now common thing when large corporation selects mid-market... Read More
We would like to give you pluses and minuses of... Read More
Looking at all the ads which promise to get rid... Read More
Software development is a risky business.Many software developers are barely... Read More
Software |