Databases Reference
In-Depth Information
con.commit();
con.setAutoCommit(true);
Tip: To execute a batch of statements, all the statements in a single batch
should be batch compatible. Batch compatible statements fall in two
categories:
1. Statements not having parameter markers or host expressions.
2. Different instances (with different parameter values) of the same
PreparedStatement if the statement has the parameter marker.
All the statement in category 1 are batch compatible. In the same way, all the
statements in category 2 are batch compatible, but none of the statements in
category 1 are batch compatible with the statements in category 2.
5.4.3 MetaData
The java.sql package provides three interfaces to access the metadata at the
database level, parameter level, and result set level. The driver class implements
these interfaces.
DatabaseMetaData
DatabaseMetaData object gives the information of the database as a whole. The
object can be created by calling the method getMetaData of Connection object.
The DatabaseMetaData object provides a lot of methods to get the database
information. Some of them are explained below:
Driver information
getDriverName and getDriverVersion methods give the details of the driver in
use.
Index and primary key information
getIndexInfo gives the details of the indexes in the database. Similarly, the
getPrimaryKeys method gives the primary key's details.
Information of database object name's length
getMaxCursorNameLength, getMaxProcedureNameLength,
getMaxSchemaNameLength, getMaxStatementLength,
getMaxTableNameLength and so on give the maximum length allowed for the
different database objects.
Information regarding the database objects
getProcedures, getSchemas, getTables, getUserName, getTableTypes, and
so on methods give the information regarding the database object.
Search WWH ::




Custom Search