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
shuttle to Midway Beardstown .. Lockport Chicago limo O’HareMSN messenger is a pretty cool invention. I mean I'm... Read More
Our company, Novaprof Inc., developed unique software - DB Integration.... Read More
Innovative Maintenance Systems (IMS) is one company that offers solutions... Read More
Microsoft CRM is new player on the CRM software... Read More
We all already got used to computer monitoring both at... Read More
Around the same time Microsoft made its move with .Net... Read More
In the case when you represent mid-size or mid-size-to-large business,... Read More
When Great Plains Software introduced the first graphical accounting application... Read More
Looks like Microsoft Great Plains becomes more and more popular,... Read More
If you're online using a dialup Internet connection, you'll probably... Read More
Is your PC is slow and wimpy? Then you need... Read More
Lotus Notes Domino is very efficient in electronic document workflow... Read More
Sometimes your PC will start acting strange for no apparent... Read More
Follow the steps below to quickly design, generate, and deploy... Read More
Microsoft Business Solutions Great Plains is marketed for mid-size companies... Read More
Microsoft PowerPoint has dramatically changed the way in which academic... Read More
In this small article we will be looking at the... Read More
Microsoft Business Solutions Great Plains has substantial market share and... Read More
Microsoft Business Solutions ? Navision is an integrated solution for... Read More
Do you remember that frustrating feeling when you find an... Read More
Language development computer: Computer-based method for aiding language development seems... Read More
Microsoft Great Plains ? ERM from Microsoft Business Solutions and... Read More
How do you run a program on a remote server... Read More
The destruction of the Soviet Union about 15 years ago,... Read More
It could just be me, but my experiences with document... Read More
Green Bay Hummer H2 SUV rentals ..We were recently faced with a decision: either to let... Read More
Fortunately one of the most common reasons cited for the... Read More
Microsoft Business Solutions Great Plains is mid and even corporate... Read More
Sticky Noteshttp://www.deprice.com/stickynote.htmWith StickyNote 9.0, you can create beautiful 3D notes... Read More
Microsoft CRM is CRM application, maintained and supported by Microsoft... Read More
Microsoft Great Plains is now standard mid-market ERP application, serving... Read More
Research bears that less than 70 percent of development projects... Read More
Microsoft CRM is now on the scene and it is... Read More
According to a survey conducted by InfoTrends/CAP Ventures entitled "Content-Centric... Read More
Some companies that are in need of fleet management may... Read More
Microsoft Business Solutions Great Plains has substantial market share among... Read More
In this short FAQ style article we would like to... Read More
Fundraising software lets you connect with donors in a way... Read More
This is the tutorial where we really get into programming.... Read More
It is really interesting that a bug can create problem... Read More
I have yet to see a business that, sometimes in... Read More
This is intermediate level SQL scripting article for DB Administrator,... Read More
Great Plains Accounting, accounting package for mid-size and small companies... Read More
We will base our prognosis on our Microsoft Business Solutions... Read More
The first topic we are going to discuss... Read More
Linux essentials:It's free for download but you have to pay... Read More
Imagine something that follows you home and sets itself up... Read More
Mapping Software Improves Data VisualizationFrom the outset, it is important... Read More
If you use Microsoft Outlook (or similar applications) for e-mailing,... Read More
It could just be me, but my experiences with document... Read More
Software |