walkinsindia.com
 
 
 
 
 
No Registration! No Resume Posting!!
 
Receive FREE Email Alerts on Current Walk-in Interviews in India, and Apply Directly to The Employer of Your Choice! - Enter your Email ID and Subscribe Right Now!

                  

 
     
 
Java JDBC
What's new in JDBC 3.0?
Probably the new features of most interest are:

Savepoint support

Reuse of prepared statements by connection pools

Retrieval of auto-generated keys

Ability to have multiple open ResultSet objects

Ability to make internal updates to the data in Blob and Clob objects

Ability to Update columns containing BLOB, CLOB, ARRAY and REF types

When I create multiple Statements on my Connection, only the current Statement appears to be executed. What's the problem?
All JDBC objects are required to be threadsafe. Some drivers, unfortunately, implement this requirement by processing Statements serially. This means that additional Statements are not executed until the preceding Statement is completed.
Can a single thread open up mutliple connections simultaneously for the same database and for same table?
The general answer to this is yes. If that were not true, connection pools, for example, would not be possible. As always, however, this is completely dependent on the JDBC driver.

You can find out the theoretical maximum number of active Connections that your driver can obtain via the DatabaseMetaData.getMaxConnections method.
Can I ensure that my app has the latest data?
Typically an application retrieves multiple rows of data, providing a snapshot at an instant of time. Before a particular row is operated upon, the actual data may have been modified by another program. When it is essential that the most recent data is provided, a JDBC 2.0 driver provides the ResultSet.refreshRow method.
What's the best way, in terms of performance, to do multiple insert/update statements, a PreparedStatement or Batch Updates?
Because PreparedStatement objects are precompiled, their execution can be faster than that of Statement objects. Consequently, an SQL statement that is executed many times is often created as a PreparedStatement object to increase efficiency.

A CallableStatement object provides a way to call stored procedures in a standard manner for all DBMSes. Their execution can be faster than that of PreparedStatement object.

Batch updates are used when you want to execute multiple statements together. Actually, there is no conflict here. While it depends on the driver/DBMS engine as to whether or not you will get an actual performance benefit from batch updates, Statement, PreparedStatement, and CallableStatement can all execute the addBatch() method.
What is JDO?
JDO provides for the transparent persistence of data in a data store agnostic manner, supporting object, hierarchical, as well as relational stores.
What is the difference between setMaxRows(int) and SetFetchSize(int)? Can either reduce processing time?
setFetchSize(int) defines the number of rows that will be read from the database when the ResultSet needs more rows. The method in the java.sql.Statement interface will set the 'default' value for all the ResultSet derived from that Statement; the method in the java.sql.ResultSet interface will override that value for a specific ResultSet. Since database fetches can be expensive in a networked environment, fetch size has an impact on performance.

setMaxRows(int) sets the limit of the maximum nuber of rows in a ResultSet object. If this limit is exceeded, the excess rows are "silently dropped". That's all the API says, so the setMaxRows method may not help performance at all other than to decrease memory usage. A value of 0 (default) means no limit.
How can I get information about foreign keys used in a table?
DatabaseMetaData.getImportedKeys() returns a ResultSet with data about foreign key columns, tables, sequence and update and delete rules.
Prev First



Post Interview Questions


 
     
     
 
Home  |  About Us  |  Post Walk-in for FREE  |  Policies  |  Contact Us  |  Advertise
 
 
Copyright © 2008 WalkinsIndia.com.   All Rights Reserved.