setoptions
Description
sets Apache Cassandra® database connection options using the opts = setoptions(opts,Option1,OptionValue1,...,OptionN,OptionValueN)CassandraConnectionOptions object opts.
Examples
Configure an Apache™ Cassandra® database connection by creating a Cassandra data source, setting the Cassandra connection options, and saving the data source.
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
Save the configured data source.
saveAsDataSource(opts)
Input Arguments
Database connection options, specified as a CassandraConnectionOptions
object.
Cassandra database connection options to set, specified as one or more name-value
pair arguments. Option is a character vector or string scalar that
specifies the name of a Cassandra database connection option. OptionValue specifies the
value of the Cassandra database connection option. OptionValue can be a
character vector, string scalar, logical scalar, or numeric scalar. You can specify any
Cassandra database connection option that is a property of the CassandraConnectionOptions object.
Example: "DataSourceName","myDataSource","ContactPoints","localhost","PortNumber",9042
configures a Cassandra data source named myDataSource that is located on the
local host address with the port number 9042.
Output Arguments
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)