com.hp.ucmdb.discovery.library.clients.query
Class QueryClient

java.lang.Object
  extended by com.hp.ucmdb.discovery.library.clients.BaseClient
      extended by com.hp.ucmdb.discovery.library.clients.query.QueryClient
Direct Known Subclasses:
LdapClient, SNMPClient, SqlClient, WMIClient

public abstract class QueryClient
extends BaseClient

QueryClient is used to execute queries using different protcols, like: WMI, SQL, and SNMP. Create a client and use the executeQuery method.
This is an example of quering an ORACLE database.:


     client = Framework.getClientFactory(ClientsConsts.SQL_PROTOCOL_NAME).createClient()
     query = 'select * from dba_users'
     resultSet = client.executeQuery(query)

     # Now looping over result and fetching data
     while resultSet.next():
                        username = resultSet.getString(1)
                        tablespace = resultSet.getString(7)

 
The credential ID is not specified when creating the client creating because it is in the trigger CI data. See the examples in ClientFactory

See Also:
ResultSet, ClientFactory

Field Summary
 
Fields inherited from class com.hp.ucmdb.discovery.library.clients.BaseClient
CREDENTIALS_ID, ENCODING
 
Method Summary
 ResultSet executeQuery(java.lang.String query)
          Submits a query and returns the result set.
 
Methods inherited from class com.hp.ucmdb.discovery.library.clients.BaseClient
close, getClientType, getCredentialId, getIpAddress, getProperty, getShellCmdSeperator, getSudoCommands, getSudoPaths, getTimeout, getUserName, isConnected, supportsSudo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

executeQuery

public ResultSet executeQuery(java.lang.String query)
                       throws java.lang.Exception
Submits a query and returns the result set.

Parameters:
query - The query to execute
Returns:
A ResultSet with database-oriented API @see ResultSet
Throws:
java.lang.Exception
See Also:
ResultSet


Documentation Feedback
Copyright 2010 Hewlett-Packard Development Company, L.P.