0

I've got Cassandra working nicely on Debian server however I'm hoping to connect to it from a PHP application.

Currently it seems PDO it the way to go for anything complex as I'm able to use CQL. I'm using the latest forked version of the Apache Cassandra-PDO project.

I'm using the latest Cassandra 2.03 and I can connect to it fine from CQLSH in the terminal. When I try and connect in PHP using the following code

$db_handle = new PDO("cassandra:host=localhost;port=9160");

I get the following error

Fatal error: Uncaught exception 'PDOException' with message 'CQLSTATE[08006] [8]     TTransportException: Transport not open' in /var/www/index.php:9 Stack trace: #0 /var/www/index.php(9): PDO->__construct('cassandra:host=...') #1 {main} thrown in /var/www/index.php on line 9

I've seem a few issues alike on the internet, but no solutions as yet. Hopefully someone can provide some insight into the issue here.

user1641165
  • 436
  • 2
  • 4
  • 17

2 Answers2

1

Error 8006 is connection failure. I think you need login and password in PDO Statment like this: $pdo = new PDO('mysql:host=localhost;dbname=products', 'root', 'root');

starko
  • 1,150
  • 11
  • 26
0

Try running 'nodetool status' from the cli to verify the IP address the server is running on.

Then perhaps change localhost to 127.0.0.1 if instead the local host.

Mahonri Moriancumer
  • 5,993
  • 2
  • 18
  • 28
Jon
  • 569
  • 4
  • 7