Neoview JDBC Type 4 Driver Programmer's Reference (R2.2, R2.3, R2.4, R2.5)
DescriptionColumn
Estimated cost associated to execute the query.TotalTime (SQL_DOUBLE)
Estimated number of rows that will be returned.Cardinality (SQL_DOUBLE)
Use of the INFOSTATS Command
The INFOSTATS command can only be used with PreparedStatement objects. The syntax is:
INFOSTATS cusor_name
where cusor_name is the name of the prepared statement. If the cursor name is,
case-sensitive, enclose in single quotes.
To get the cursor name, use the getStatementLabel() method that is defined for the HP
JDBC Type 4 driver with class:
com.hp.t4jdbc.HPT4PreparedStatement:
public String getStatementLabel();
Considerations
• You can use INFOSTATS in these methods only:
java.sql.Statement.executeQuery(String sql)
java.sql.Statement.execute(String sql)
• setCursorName is not supported with INFOSTATS.
• If you invoke INFOSTATS incorrectly, the Type 4 driver issues this error:
Message: INFOSTATS command can only be executed
by calling execute(String sql) method.
Sqlstate HY000
Sqlcode 29180
Example of INFOSTATS
Statement s = conn.createStatement( );
HPT4PreparedStatement p =
(HPT4PreparedStatement)conn.prepareStatement(
"select * from t where I = ?");
boolean results = s.execute("INFOSTATS " + p.getStatementLabel());
if(results)
{
ResultSet rs = s.getResultSet( );
whi1e(rs.next( ) )
{
//process data
}
}
Sample Output
QueryID: MXID001001128212016369912348191_16_SQL_CUR_9829657
CPUTime: 0.09975778464794362
IOTime: 0.10584000146627659
MsgTime: 0.09800000134418951
IdleTime: 0.09800000134418951
TotalTime: 0.10584000146627659
Cardinality: 100.0
30 Accessing Neoview SQL Databases