GuardAPI Datasource Functions

create_datasource

Use this command to define a new datasource.

Parameters

Parameter

Description

type

Required. Identifies the datasource type; it must be one of the following:

ORACLE
DB2

INFORMIX

"MS SQL SERVER" (Note: Quotes are required.)

MYSQL

SYBASE

In addition to the above, the following can be used when the application (see below) is CustomDomain or Classifier:

TEXT

TEXT:FTP

TEXT:HTTP

TEXT:HTTPS

TEXT:SAMBA

name

Required. Provides a unique name for the datasource on the system.

description

Optional. Longer description of the datasource.

host

Required. Can be the host name or the IP address.

port

Optional (integer). Port number.

serviceName

Optional. For an Oracle datasource, enter the service name.

user

Optional. User for the datasource. If used, password (below) must also be used.

password

Optional. Password for above. If used, user (above) must also be used.

dbName

Optional. For DB2 datasources, enter the database name.

shared

Optional (boolean). Set to true to share with other applications. To share the datasource with other users, you will have to assign roles from the GUI.

conProperty

Optional. Use only if additional connection properties must be included on the JDBC URL to establish a JDBC connection with this datasource. The required format is property=value, where each property and value pair is separated from the next by a comma. Known uses for this property are described below:

For a Sybase database with a default character set of Roman8, enter the following property:

CHARSET=utf8

application

Required. Identifies the application for which the datasource is being defined. It must be one of the following:

Access_policy

MonitorValues

DatabaseAnalyzer

AuditDatabase

CustomDomain

Classifier,

AuditTask

SecurityAssessment

owner

Required. Identifies the Guardium user account that owns the datasource.

Example

grdapi create_datasource type=DB2 name=chickenDB2  password=guardium user=db2inst1 dbName=dn0chick owner=admin application=Access_policy shared=true port=50000 host=chicken.guardium.com

Error Codes

ERR

Description

101

Invalid Datasource Type.

102

Error creating Datasource, a Datasource with the specified name already exists.

103

Invalid application - should be one of : Access_policy, MonitorValues,DatabaseAnalyzer,AuditDatabase,CustomDomain,Classifier,AuditTask,SecurityAssessment

104

Error creating datasource - either password or username is empty.

105

Error creating datasource - owner does not exist.

106

Error creating datasource - must specify a dbName for DB2.

107

Error creating datasource - must specify a service name.

108

Error creating datasource - data might be corrupted.

109

Error setting owner for newly created datasource.

110

Error creating datasource - no name has been specified.

111

Error creating datasource - no host has been specified.

112

Could not complete the operation - TERADATA, TEXT, TEXT:FTP, TEXT:HTTP, TEXT:HTTPS, and TEXT:SAMBA types are either not supported by this application or the application is not licensed to use them.

list_datasource_by_name

Displays a datasource definition identified by a name.

Parameters

Parameter

Description

name

Required. The datasource name.

Example

g4.guardium.com> grdapi list_datasource_by_name name=chickenDB2

ID=20000

Datasource DatasourceId=20000

Datasource DatasourceTypeId=2

Datasource Name=chickenDB2

Datasource Description=null

Datasource Host=chicken.guardium.com

Datasource Port=50000

Datasource ServiceName=

Datasource UserName=db2inst1

Datasource Password=[B@1415de6

Datasource PasswordStored=true

Datasource DbName=dn0chick

Datasource LastConnect=null

Datasource Timestamp=2008-04-18 15:40:58.0

Datasource ApplicationId=2

Datasource Shared=true

Datasource ConProperty=null

Datasource type = DB2

Application Type = Access_policy

ok

Error Codes

ERR

Description

112

Could not retrieve Datasource - check name.

114

Error listing datasource - data might be corrupted.

list_datasource_by_id

Displays a datasource definition identified by an ID key.

Parameters

Parameter

Description

id

Required (integer). Enter the ID number of the datasource to be listed.

Example

grdapi list_datasource_by_id id=2

Error Codes

ERR

Description

113

Could not retrieve Datasource - check Id.

114

Error listing datasource - data might be corrupted.

remove_datasource_by_name

Deletes the specified datasource definition, unless that datasource is being used by an application. This function removes the datasource, regardless of the owner.

Parameters

Parameter

Description

name

Required. The name of the datasource to be removed.

Example

grdapi remove_datasource_by_name name=swanSybase

Error Codes

ERR

Description

120

Could not delete Datasource.

121

Could not delete datasource. it could not be located.

122

Could not delete datasource. audit datasource can only be deleted from Value Change Database Builder

123

Could not delete datasource. This datasource is being used by at least one Monitor value jobs

124

Could not delete datasource. This datasource is being used by at least one Custom Tables.

125

Could not delete datasource. This datasource is being used by at least one Classification Processes.

126

Could not delete datasource. Error while checking usage.

127

Could not delete datasource owner/role.

128

Could not delete datasource. This datasource is being used by at least one Audit Process

remove_datasource_by_id

Deletes the specified datasource definition, unless that datasource is being used by an application. This function removes the datasource, regardless of the owner.

Parameters

Parameter

Description

id

Required (integer). Identifies the datasource to be deleted.

Example

grdapi remove_datasource_by_id id=2

Error Codes

ERR

Description

120

Could not delete Datasource.

121

Could not delete datasource. it could not be located.

122

Could not delete datasource. audit datasource can only be deleted from Value Change Database Builder

123

Could not delete datasource. This datasource is being used by at least one Monitor value jobs

124

Could not delete datasource. This datasource is being used by at least one Custom Tables.

125

Could not delete datasource. This datasource is being used by at least one Classification Processes.

126

Could not delete datasource. Error while checking usage.

127

Could not delete datasource owner/role.

128

Could not delete datasource. This datasource is being used by at least one Audit Process

update_datasource_by_name

Updates a datasource definition.

Parameters

Parameter

Description

name

Required. Identifies the datasource to be updated.

newName

Optional. Provides a new name, which must be unique for a datasource on the system.

description

Optional. Longer description of the datasource.

host

Optional. Can be the host name or the IP address.

port

Optional (integer). Port number.

serviceName

Optional. For an Oracle datasource, enter the service name.

user

Optional. User for the datasource. If used, password (below) must also be used.

password

Optional. Password for above. If used, user (above) must also be used.

dbName

Optional. For DB2 datasources, enter the database name.

shared

Optional (boolean). Set to true to share with other applications. To share the datasource with other users, you will have to assign roles from the GUI.

conProperty

Optional. Use only if additional connection properties must be included on the JDBC URL to establish a JDBC connection with this datasource. The required format is property=value, where each property and value pair is separated from the next by a comma. Known uses for this property are described below:

For a Sybase database with a default character set of Roman8, enter the following property:

CHARSET=utf8

Example

grdapi update_datasource_by_name name=chickenDB2  newName="chicken DB2"  user=" " password=" "

Error Codes

ERR

Description

112

Could not retrieve Datasource - check name.

131

Could not update Datasource.

132

Could not update Datasource - a Datasource with the specified name already exists.

133

Could not update Datasource - both password & user should have values.

134

Could not update Datasource - must specify a dbName for DB2.

135

Could not update Datasource - must specify a service name.

136

Could not update Datasource - error while checking credentials.

update_datasource_by_id

Updates a datasource definition.

Parameters

Parameter

Description

id

Required (integer). Identifies the datasource.

- all other parameters -

See the update_datasource_by_name topic, above, except id (above) replaces name.

Example

grdapi update_datasource_by_id id=20000 user=" " password=" " newName="chickenDB2hooo"

Error Codes

ERR

Description

130

Could not retrieve Datasource - Invalid id.

131

Could not update Datasource.

132

Could not update Datasource - a Datasource with the specified name already exists.

133

Could not update Datasource - both password & user should have values.

134

Could not update Datasource - must specify a dbName for DB2.

135

Could not update Datasource - must specify a service name.

136

Could not update Datasource - error while checking credentials.