|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.hp.ucmdb.discovery.library.clients.BaseClient com.hp.ucmdb.discovery.library.clients.query.QueryClient com.hp.ucmdb.discovery.library.clients.query.SqlClient
public class SqlClient
The SqlClient
class provides the basic APIs for database queries.
SqlClient
works with ORACLE, SYBASE, MS SQL server, and DB2.
Methods that interact with the database use the timeout from the credentials unless
a timeout is passed explicitly to the method.
See the example in the QueryClient
reference.
QueryClient
Field Summary | |
---|---|
static java.lang.String |
JDBC_RESOURCE_DIR
|
static java.lang.String |
UAVAILABLE_DB_VERSION
|
Fields inherited from class com.hp.ucmdb.discovery.library.clients.BaseClient |
---|
CREDENTIALS_ID, ENCODING |
Constructor Summary | |
---|---|
SqlClient(ClientsFrameworkImpl framework,
java.util.Properties props)
|
Method Summary | |
---|---|
ResultSet |
doCall(java.lang.String sqlStatement)
Executes a Select or Update query. |
ResultSet |
doCall(java.lang.String sqlStatement,
int queryTimeout)
Executes a Select or Update query with the specified timeout. |
ResultSet |
executeQuery(java.lang.String query)
Executes a Select query. |
ResultSet |
executeQuery(java.lang.String query,
int queryTimeout)
Executes a Select query with the specified timeout. |
java.lang.String |
getAppVersion()
Returns the version of the database to which the client is connected. |
java.lang.String |
getDatabaseName()
Returns Oracle SID or the database name from the protocol definition. |
java.lang.String |
getDbVersion()
Returns the database version number. |
int |
getPort()
Returns the port on which the database server listens. |
java.lang.String |
getProtocolDbType()
Returns the database type. |
java.lang.String |
getSid()
Returns the Database System ID(database instance name) |
ResultSet |
getTable(java.lang.String query)
Deprecated. use executeQuery(java.lang.String) |
ResultSet |
getTable(java.lang.String query,
int queryTimeout)
Deprecated. use executeQuery(java.lang.String) |
java.lang.String |
getWorkingDatabase()
Returns the name of the schema to which the client is connected. |
void |
setWorkingDatabase(java.lang.String dbName)
Sets the database schema name to which the client connects. |
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 |
Field Detail |
---|
public static final java.lang.String JDBC_RESOURCE_DIR
public static final java.lang.String UAVAILABLE_DB_VERSION
Constructor Detail |
---|
public SqlClient(ClientsFrameworkImpl framework, java.util.Properties props) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public java.lang.String getSid()
public java.lang.String getDatabaseName()
public void setWorkingDatabase(java.lang.String dbName) throws java.lang.Exception
dbName
- The schema name
java.lang.Exception
public java.lang.String getWorkingDatabase() throws java.lang.Exception
getWorkingDatabase
uses the database specified in the credentials.
java.lang.Exception
public ResultSet executeQuery(java.lang.String query) throws java.lang.Exception
Select
query.
executeQuery
in class QueryClient
query
- An SQL query statement
ResultSet
java.lang.Exception
ResultSet
public ResultSet executeQuery(java.lang.String query, int queryTimeout) throws java.lang.Exception
Select
query with the specified timeout.
query
- An SQL query statementqueryTimeout
- The timeout in milliseconds
ResultSet
java.lang.Exception
ResultSet
public ResultSet getTable(java.lang.String query) throws java.lang.Exception
executeQuery(java.lang.String)
Select
query.
query
- sql query statement
java.lang.Exception
ResultSet
public ResultSet getTable(java.lang.String query, int queryTimeout) throws java.lang.Exception
executeQuery(java.lang.String)
Select
query.
query
- sql query statementqueryTimeout
- The timeout in milliseconds
java.lang.Exception
ResultSet
public ResultSet doCall(java.lang.String sqlStatement) throws java.lang.Exception
Select
or Update
query.
sqlStatement
- An SQL statement
ResultSet
java.lang.Exception
ResultSet
public ResultSet doCall(java.lang.String sqlStatement, int queryTimeout) throws java.lang.Exception
Select
or Update
query with the specified timeout.
sqlStatement
- An SQL statementqueryTimeout
- The timeout in milliseconds
ResultSet
java.lang.Exception
ResultSet
public java.lang.String getProtocolDbType()
public int getPort()
public java.lang.String getDbVersion()
public java.lang.String getAppVersion()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |