stax_open()

Description:

Create connection to the Cassandra database.

Syntax:

stax_open(nodes[:port][,keyspace][,user:pwd][,compressor][,version:verX] [,queryOptions:optionX]) 

Note:

CassandraCli external library function (See External Library Guide). The username and password are required if the Cassandra database is started under the PasswordAuthenticator mode; but not required if the Cassandra database is started under the authenticator: AllowAllAuthorizer mode.

Parameter:

nodes

The to-be-connected database’s IP address.

port

Port number; can be omitted. Default is 9042.

user:pwd

User name and password; can be omitted under the AllowAllAuthorizer mode.

keyspace

The keyspace name; the table name format should be keyspace.table when omitted.

compressor

A compression algorithm, which is LZ4, Snappy and none; default is none.

version

Protocol version information; can be absent.

queryOptions

A query option, which includes ANY, ONE, TOW, THREE, ALL and QUORUM; there are details in Cssandra documentation.

Return value:

Database connection

Example:

 

A

 

1

=stax_open("127.0.0.1":9042, "mycasdb")

Cassandra database connection under the AllowAllAuthorizer mode. Both username and password can be absent.

2

=stax_open("127.0.0.1":9042, "mycasdb")

Cassandra database connection under the PasswordAuthenticator mode. Both username and password should be present.

3

=stax_open("127.0.0.1":9042, "mycasdb","cassandra":"cassandra":"lz4")

Set compression algorithm as LZ4.

4

=stax_open("127.0.0.1")

port value is 9042 by default.

5

=stax_query(A4,"select * from mycasdb.user")

Parameter keyspace is absent. Use keyspace.table format in the query.