Interface DatabaseAdmin
- All Superinterfaces:
AutoCloseable
Normal application code should use SelectAI. Use
DatabaseAdmin only from setup or administrative workflows that run
with database users authorized to change package privileges, data-access
settings, or network ACL entries.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases resources owned by this DatabaseAdmin client.static DatabaseAdmincreate(DbConnectionConfig dbConnectionConfig) Creates a DatabaseAdmin client from database connection configuration.static DatabaseAdmincreate(DbConnectionConfig dbConnectionConfig, SelectAIOptions options) Creates a DatabaseAdmin client from database connection configuration and SDK execution options.static DatabaseAdmincreate(DataSource dataSource) Creates a DataSource-backed DatabaseAdmin client.static DatabaseAdmincreate(DataSource dataSource, SelectAIOptions options) Creates a DataSource-backed DatabaseAdmin client with SDK execution options.booleanPrevents Select AI features from sending table data or vector-search document content to the model when those features would otherwise use it.booleanAllows Select AI features to send table data or vector-search document content to the model when a feature needs that data.booleangrantHttpAccess(List<String> selectAIUsers, String host) Grants HTTP network ACL access for the specified database users.booleangrantNetworkAccess(List<String> selectAIUsers, String host, List<String> privileges, Integer lowerPort, Integer upperPort) Grants network ACL privileges to the specified database users.booleangrantPrivileges(List<String> selectAIUsers) Grants required Select AI package privileges to the specified database users.booleanrevokeHttpAccess(List<String> selectAIUsers, String host) Revokes HTTP network ACL access for the specified database users.booleanrevokeNetworkAccess(List<String> selectAIUsers, String host, List<String> privileges, Integer lowerPort, Integer upperPort) Revokes network ACL privileges for the specified database users.booleanrevokePrivileges(List<String> selectAIUsers) Revokes required Select AI package privileges from the specified database users.
-
Method Details
-
create
Creates a DatabaseAdmin client from database connection configuration.For a complete runnable sample source, see GrantPrivilegesSample source.
- Parameters:
dbConnectionConfig- database connection configuration- Returns:
- DatabaseAdmin client
- Throws:
IllegalArgumentException- whendbConnectionConfigis nullSelectAIException- when the database connection cannot be initialized
-
create
static DatabaseAdmin create(DbConnectionConfig dbConnectionConfig, SelectAIOptions options) throws SelectAIException Creates a DatabaseAdmin client from database connection configuration and SDK execution options.For a complete runnable sample source, see CreateDatabaseAdminWithOptionsSample source.
- Parameters:
dbConnectionConfig- database connection configurationoptions- SDK execution options;nullusesSelectAIOptions.defaults()- Returns:
- DatabaseAdmin client
- Throws:
IllegalArgumentException- whendbConnectionConfigis nullSelectAIException- when the database connection cannot be initialized
-
create
Creates a DataSource-backed DatabaseAdmin client.For a complete runnable sample source, see CreateDatabaseAdminDataSourceSample source.
- Parameters:
dataSource- DataSource used to obtain JDBC connections- Returns:
- DatabaseAdmin client
- Throws:
IllegalArgumentException- whendataSourceis null
-
create
Creates a DataSource-backed DatabaseAdmin client with SDK execution options.For a complete runnable sample source, see CreateDatabaseAdminDataSourceWithOptionsSample source.
- Parameters:
dataSource- DataSource used to obtain JDBC connectionsoptions- SDK execution options;nullusesSelectAIOptions.defaults()- Returns:
- DatabaseAdmin client
- Throws:
IllegalArgumentException- whendataSourceis null
-
enableDataAccess
Allows Select AI features to send table data or vector-search document content to the model when a feature needs that data.For a complete runnable sample source, see EnableSelectAIDataAccessSample source.
- Returns:
truewhen the database accepts the enable request- Throws:
SelectAIException- when the database rejects or cannot execute the enable request
-
disableDataAccess
Prevents Select AI features from sending table data or vector-search document content to the model when those features would otherwise use it.For a complete runnable sample source, see DisableSelectAIDataAccessSample source.
- Returns:
truewhen the database accepts the disable request- Throws:
SelectAIException- when the database rejects or cannot execute the disable request
-
grantPrivileges
Grants required Select AI package privileges to the specified database users.For a complete runnable sample source, see GrantPrivilegesSample source.
- Parameters:
selectAIUsers- database users whose package privileges are granted- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the grant requests complete- Throws:
SelectAIException- when package grants cannot be applied
-
revokePrivileges
Revokes required Select AI package privileges from the specified database users.For a complete runnable sample source, see RevokePrivilegesSample source.
- Parameters:
selectAIUsers- database users whose package privileges are revoked- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the revoke requests complete- Throws:
SelectAIException- when package grants cannot be revoked
-
grantHttpAccess
Grants HTTP network ACL access for the specified database users.For a complete runnable sample source, see GrantHttpAccessSample source.
- Parameters:
selectAIUsers- database users whose HTTP access is grantedhost- host name or host pattern to add to the ACL- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the grant requests complete- Throws:
IllegalArgumentException- whenhostis null or blankSelectAIException- when network ACL updates cannot be applied
-
revokeHttpAccess
Revokes HTTP network ACL access for the specified database users.For a complete runnable sample source, see RevokeHttpAccessSample source.
- Parameters:
selectAIUsers- database users whose HTTP access is revokedhost- host name or host pattern to remove from the ACL- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the revoke requests complete- Throws:
IllegalArgumentException- whenhostis null or blankSelectAIException- when network ACL updates cannot be revoked
-
grantNetworkAccess
boolean grantNetworkAccess(List<String> selectAIUsers, String host, List<String> privileges, Integer lowerPort, Integer upperPort) throws SelectAIException Grants network ACL privileges to the specified database users.For a complete runnable sample source, see GrantNetworkAccessSample source.
- Parameters:
selectAIUsers- database users whose network access is grantedhost- host name or host pattern to add to the ACLprivileges- network ACL privileges to grant, such ashttporconnectlowerPort- optional lower port; passnullwhen not neededupperPort- optional upper port; passnullwhen not needed- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the grant requests complete- Throws:
IllegalArgumentException- whenhostis null or blank,privilegeshas no non-blank values, a port is outside0..65535, orlowerPortis greater thanupperPortSelectAIException- when network ACL updates cannot be applied
-
revokeNetworkAccess
boolean revokeNetworkAccess(List<String> selectAIUsers, String host, List<String> privileges, Integer lowerPort, Integer upperPort) throws SelectAIException Revokes network ACL privileges for the specified database users.For a complete runnable sample source, see RevokeNetworkAccessSample source.
- Parameters:
selectAIUsers- database users whose network access is revokedhost- host name or host pattern to remove from the ACLprivileges- network ACL privileges to revoke, such ashttporconnectlowerPort- optional lower port; passnullwhen not neededupperPort- optional upper port; passnullwhen not needed- Returns:
falsewhen the user list is null or empty; otherwisetruewhen the revoke requests complete- Throws:
IllegalArgumentException- whenhostis null or blank,privilegeshas no non-blank values, a port is outside0..65535, orlowerPortis greater thanupperPortSelectAIException- when network ACL updates cannot be revoked
-
close
Releases resources owned by this DatabaseAdmin client.For a complete runnable sample source, see CloseDatabaseAdminSample source.
- Specified by:
closein interfaceAutoCloseable- Throws:
SelectAIException- when an owned JDBC connection cannot be closed
-