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
limousine Ackley .. Lockport Chicago limo O’HareProgramming Help for BeginnersWe write programs to instruct computers. When... Read More
Each Industry and market niche has business specific and unique... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Have you noticed WordPerfect is gearing up for a comeback... Read More
Once upon a time not so long ago, there was... Read More
How do you run a program on a remote server... Read More
At the end of XX century, in the late 1990th... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
A wiki is an editable text-based website. But you don't... Read More
The vast majority of us will have, at some point,... Read More
Rapid Application Development (RAD) is a software development methodology. In... Read More
Microsoft Business Solutions offers several ERP applications: Great Plains, Navision,... Read More
1. Replace Dexterity cursor with SQL Stored Procedure Dexterity... Read More
Manufacturing in the USA is far away down from mid... Read More
XML parser is a software module to read documents and... Read More
In order to implement VLANs in a network environment, you'll... Read More
Most people understand that the "hardware" part of their computer... Read More
In our small article we'll consider Microsoft Business Solutions Great... Read More
CD and DVD replication is a process that works by... Read More
We live in a post-industrial age where information is the... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
Microsoft Great Plains - Microsoft Business Solutions accounting and ERP... Read More
Remember old good days when your company probably had Great... Read More
Navision Software was purchased by Microsoft and now it is... Read More
shuttle from O'Hare Alexander ..Best Software Act! is very popular CRM for small and... Read More
(1) Avoid using the same variable again and again for... Read More
Task Manager is a Windows system utility that displays thetasks... Read More
Healthcare facilities such as clinics, hospitals, and biomedical laboratories can... Read More
2005 ? Back to the Future.What does the future hold?... Read More
In a previous article, I wrote about OpenOffice... Read More
The java programming language is becoming more and more popular... Read More
The intuitive algorithm.Roger Penrose considered it impossible. Thinking could never... Read More
No matter how much you enjoy your favorite screensavers, sometimes... Read More
Formatting and reinstalling windows 98 is very easy if you... Read More
Before September of 1995, Microsoft ignored the Internet because their... Read More
Microsoft CRM is CRM answer from Microsoft and attempt to... Read More
Looks like Microsoft Great Plains becomes more... Read More
While Adobe is the most known maker of PDF tools,... Read More
First we had the original Google search that evolved into... Read More
Microsoft Business Solutions Great Plains is very good fit for... Read More
Great Plains Fixed Assets Management module is a robust tool... Read More
Just when you thought you were Web savvy, one more... Read More
In this small article we will show you the possible... Read More
Scrapbooks are very popular these days. I think that almost... Read More
A LOT OF UNWANTED FILES.When you uninstall an item of... Read More
Need help making sense of algebra? Have algebra lectures in... Read More
Usually, the easiest way to tell you have spyware is... Read More
Microsoft Business Solutions is now in process of creating so... Read More
In the previous ISDN article, we looked at how and... Read More
Software |