What is the difference between java.util.Iterator and
java.util.ListIterator?
Iterator : Enables you to traverse through a
collection in the forward direction only, for obtaining or removing elements
ListIterator : extends Iterator, and allows
bidirectional traversal of list and also allows the modification of elements.
What is Metadata and why should I use it?
JDBC API has 2 Metadata interfaces
·
DatabaseMetaData
·
ResultSetMetaData.
The DatabaseMetaData
provides Comprehensive information about the database as a whole. This
interface is implemented by driver vendors to let users know the capabilities
of a Database Management System (DBMS) in combination with the driver based on
JDBC technology ("JDBC driver") that is used with it. Below is a
sample code which demonstrates how we can use the DatabaseMetaData
DatabaseMetaData md = conn.getMetaData();
System.out.println("Database Name: "
+ md.getDatabaseProductName());
System.out.println("Database Version:
" + md.getDatabaseProductVersion());
System.out.println("Driver Name: " +
md.getDriverName());
System.out.println("Driver Version:
" + md.getDriverVersion());
The ResultSetMetaData is an object that can be used
to get information about the types and properties of the columns in a ResultSet
object. Use DatabaseMetaData to find information about your database, such as
its capabilities and structure. Use ResultSetMetaData to find information about
the results of an SQL query, such as size and types of columns. Below a sample
code which demonstrates how we can use the ResultSetMetaData
ResultSet rs = stmt.executeQuery("SELECT a, b,
c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
int
numberOfColumns = rsmd.getColumnCount();
boolean b
= rsmd.isSearchable(1);
Visit:www.sssedu.inhttp://sssedu.in/java-training-in-chennai.html
No comments:
Post a Comment