-2

I want to know how to connect to Cassandra using Perl, and insert, select, update etc.

I tried this

my $dbh = DBI->connect(
    "dbi:Cassandra:host=localhost;keyspace=nomkeyspace",
    "root",
    '',
    { RaiseError => 1 }
);

my $rows = $dbh->selectall_arratref( "SELECT id, nom" );

for my $row ( @$rows ) {
    print( "ok" );
}

$dbh->do( "insert into resultat (ip, nom) values (?,?)" );

$dbh->disconnect;

but it's give me this error

Can't locate DBD/Cassandra.pm in @INC (you may need to install the DBD::Cassandra module)

thanks

Borodin
  • 126,100
  • 9
  • 70
  • 144
Ussopokingo
  • 109
  • 1
  • 2
  • 11

1 Answers1

1

You have to install the reqired perl module DBD::Cassandra

You can do this with perl -MCPAN -e install "DBD::Cassandra"

Jens
  • 67,715
  • 15
  • 98
  • 113