0

I have developed a database on Astra db, a DaaS application. I ran into some issues trying to connect it to MATLAB and would like some possible explanations and maybe solutions as to why this happened.

I tried using a secure bundle and an ODCB driver. However, I was not able to connect to the database on either approach.

If any further information is needed, comment and I will update this post.

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Martin
  • 61
  • 2
  • 9
  • Welcome to Stack Overflow! You'll need to provide additional details so others can help you. The general guidance is that you (a) provide a good summary of the problem that includes software/component versions, the full error message + full stack trace; (b) describe what you've tried to fix the problem, details of investigation you've done; and (c) minimal sample code that replicates the problem. Cheers! – Erick Ramirez Sep 11 '22 at 06:36

1 Answers1

1

Give the following articles a read if you haven't already...

Give the following a try...

Step-1: From the Astra console, generate an application token - see Manage application tokens for guidance. To make things simple, the token's role to "Administrator User". Save the client id, client secret, and token. You'll need them later.

Step-2: From the Astra console, download the secure-connection-bundle for your database. From the main dashboard, click on your database, choose the Connect tab, and click the Download Bundle button.

Step-3: Unzip the secure connection bundle and open the config.json file. Pull the host and port from the file.

Step-4: In Matlab, script your connection and query out. You'll need the Database Toolbox if you're trying this from Matlab online.

datasource = "CassandraDataSource";
username = "<client_id>";
password = "<client_secret>";
conn = apacheCassandra(datasource, username, password, 'ContactPoints', <host>, 'PortNumber', <port>, 'SSLEnabled', true);

query = strcat("SELECT whatevs ", ... 
    "FROM keyspace.table ", ...
    "WHERE primary_key IN ('foo','bar')";

results = executecql(conn, query);

close(conn)

Good luck!

Adam
  • 3,891
  • 3
  • 19
  • 42