reset
Syntax
Description
resets
all Apache Cassandra® database connection options to their default values for all properties of the
opts
= reset(opts
)CassandraConnectionOptions
object.
Examples
Reset Cassandra Connection Options to Default Values
Create, configure, and test an Apache™ Cassandra® data source for a Cassandra database. Reset the Cassandra connection options to their default values. Then configure, test, and save the data source with different Cassandra connection options.
Create a Cassandra data source for a Cassandra database connection.
vendor = "Cassandra"; opts = databaseConnectionOptions("native",vendor)
opts = CassandraConnectionOptions with properties: DataSourceName: "" Vendor: "Cassandra" ContactPoints: "localhost" PortNumber: 9042 SSLEnabled: false LoginTimeout: 5 RequestTimeout: 12
opts
is an CassandraConnectionOptions
object with these properties:
DataSourceName
— Name of the data sourceVendor
— Database vendor nameContactPoints
— Contact pointsPortNumber
— Port numberSSLEnabled
— SSL-enabled connectionLoginTimeout
— Login timeoutRequestTimeout
— Request timeout
Configure the data source by setting the Cassandra connection options for the data source CassandraDataSource
, local host address for one node in the cluster, port number 9042
, SSL encryption that is disabled, login timeout of 5 seconds, and request timeout of 12 seconds.
opts = setoptions(opts, ... "DataSourceName","CassandraDataSource", ... "ContactPoints","localhost","PortNumber",9042, ... "SSLEnabled",false,"LoginTimeout",5, ... "RequestTimeout",12)
opts = CassandraConnectionOptions with properties: DataSourceName: "CassandraDataSource" Vendor: "Cassandra" ContactPoints: "localhost" PortNumber: 9042 SSLEnabled: false LoginTimeout: 5 RequestTimeout: 12
The setoptions
function sets the DataSourceName
, ContactPoints
, PortNumber
, SSLEnabled
, LoginTimeout
, and RequestTimeout
properties in the CassandraConnectionOptions
object.
Test the database connection with a blank user name and password. The testConnection
function returns the logical 1
, which indicates the database connection is successful.
username = ""; password = ""; status = testConnection(opts,username,password)
status = logical
1
Reset the Cassandra connection options to their default values. The properties of the CassandraConnectionOptions
object contain the default values.
opts = reset(opts)
opts = CassandraConnectionOptions with properties: DataSourceName: "" Vendor: "Cassandra" ContactPoints: "localhost" PortNumber: 9042 SSLEnabled: false LoginTimeout: 5 RequestTimeout: 12
Configure the data source by setting the Cassandra connection options for the data source CassandraDataSource
, local host address for one node in the cluster, port number 9042
, SSL encryption that is disabled, login timeout of 5 seconds, and request timeout of 20 seconds.
opts = setoptions(opts, ... "DataSourceName","CassandraDataSource", ... "ContactPoints","localhost","PortNumber",9042, ... "SSLEnabled",false,"LoginTimeout",5, ... "RequestTimeout",20)
opts = CassandraConnectionOptions with properties: DataSourceName: "CassandraDataSource" Vendor: "Cassandra" ContactPoints: "localhost" PortNumber: 9042 SSLEnabled: false LoginTimeout: 5 RequestTimeout: 20
The setoptions
function sets the DataSourceName
, ContactPoints
, PortNumber
, SSLEnabled
, LoginTimeout
, and RequestTimeout
properties in the CassandraConnectionOptions
object.
Test the database connection again.
username = ""; password = ""; status = testConnection(opts,username,password)
status = logical
1
Save the configured data source.
saveAsDataSource(opts)
Input Arguments
opts
— Database connection options
CassandraConnectionOptions
object
Database connection options, specified as a CassandraConnectionOptions
object.
Output Arguments
opts
— Database connection options
CassandraConnectionOptions
object
Database connection options, returned as a CassandraConnectionOptions
object.
Version History
Introduced in R2021a
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)