stax_connect ()

Description:

Create connection to the Cassandra database.

Syntax:

stax_connect(nodes[:port] [,user:pwd ][;[keyspace:xx][,compressor][,initializer]) 

Note:

The username and password are not required if the Cassandra database is started under the PasswordAuthenticator mode; but required if the Cassandra database is started under the authorizer: AllowAllAuthorizer mode. The Java class specified in the parameter initializer should be a complete class path.

Parameters:

nodes

The to-be-connected database’s IP address

port

Port number; can be omitted

user:pwd

User name and password; can be omitted

keyspace:xx

The keyspace name; can be omitted

compressor

The compression algorithm; can be omitted

initializer

The Java class for client-side initialization; can be omitted

Return value:

The database connection

Example:

 

A

 

1

=stax_connect("127.0.0.1";keyspace:"mycas")

Cassandra database connection under the authorizer: AllowAllAuthorizer mode

2

=stax_connect("127.0.0.1","cassandra":"cassandra"; keyspace:"mycas")

Cassandra database connection under the PasswordAuthenticator mode