Software informational articles

Accomplishment tuning of a daffodil db / one$db -jdbc concentration - software

 

This critique illustrates the best practices to advance the carrying out of Daffodil DB / One$DB JDBC Driver. This commentary focuses on how to convalesce the act of a Daffodil DB / One$DB JDBC claim using Statement, PreparedStatemnt, CallableStatement and ResultSet interfaces. Choosing the right account interfaces and right methods according to your SQL query plays a vital role in civilizing the act of a JDBC Driver.

JDBC Overview

JDBC API provides banner set of interfaces to work with databases like Daffodil DB / One$DB, Oracle, Derby etc.

Connection border encapsulates list bond functionality, Assertion border encapsulates SQL announcement depiction and execution functionality but ResultSet border 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 far ahead JDBC aspect like XA is to be used)

2. Load Daffodil DB JDBC driver (embedded or complex JDBC Driver)

3. Create correlation to catalog using Correlation interface

4. Conceive a Statement

5. Complete the Statement

6. Retrieve outcome by using ResultSet interface

7. Close Account and Connection

Choosing right Account interface:

There are three types of Announcement interfaces in JDBC to represent/execute a SQL query-Statement, PreparedStatement and CallableStatement. Account is used for executing static SQL account with no input and crop parameters; PreparedStatement is used to carry out dynamic SQL account with input parameters but CallableStatement is used to effect dynamic SQL with both input and harvest parameters. One crucial thing to note about PreparedStatement and CallableStatement is that they can also be used for static SQL statements. However, CallableStatement is above all meant for stored procedures.

PreparedStatement gives change for the better accomplishment when compared to Account for the reason that it is pre-parsed and pre-compiled. This means that compilation and parsing of such account is done only once by the database. Afterwards the catalog reuses the before now parsed and compiled statement. This appreciably improves the act for the reason that every time a account 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 assertion can be reduced.

When there is a necessity for distinct appeal to deal with compound complicated statements, CallableStatement gives beat act as compared to PreparedStatement and Statement.

To read the full critique entertain visit http://www. daffodildb. com/daffodildb-performance-tuning. html

This critique has been contributed by (Mr. ) Parveen Aggarwal, Industrial Consultant to DSL India (http://www. daffodildb. com). With more than 6 years of business come across in Java and combined technologies, he has an in-depth appreciation of J2EE, J2ME and catalog management systems. Parveen is at present operational on the hypothesis of data-archiving in embedded databases. He can be contacted at parveenaggarwal@hotmail. com


MORE RESOURCES:
Developed by:
home | site map
goldenarticles.net © 2018