- Path to the JDBC driver
- Username
- Password
- Database name
- IP address of the virtual machine.
How to connect MATLAB on windows OS to Clickhouse database server on a cloud Linux virtual machine?
17 views (last 30 days)
Show older comments
Hi,
My computations are stored in a Clickhouse databse server on a Linux (Ubuntu) virtual machine (VM). I would like to access the data from the Clickhouse server on the VM to MATLAB in my local machine on windows OS, so that I can process the data locally.
I tried to explore the database tool box, but since I am new to this, I haven't been able to connect to the database on the VM.
I would appreciate pointers from the experts.
Thanks in advance.
0 Comments
Answers (2)
Tejas
on 27 Mar 2024
Hello Usman,
It seems you are interested in finding a way to connect a ClickHouse database to MATLAB. To achieve this, a suitable JDBC driver for the ClickHouse database is needed. Once the driver is installed, connect it to MATLAB using the “javaaddpath” command. For more detailed instructions on this command, please refer to the following documentation: https://www.mathworks.com/help/matlab/ref/javaaddpath.html .
Now, create a data source (which acts like a connection object), using ‘databaseConnectionOptions’ command. It is worth noting that the ClickHouse Database is not directly supported by the MATLAB Database Toolbox, so set the ‘vendor’ property to 'other'. For more information on this, please consult the following documentation link: https://www.mathworks.com/help/database/ug/databaseconnectionoptions.html#:~:text=vendor%20%E2%80%94%20Database%20vendor%0A%22Microsoft,vector%20or%20a%20string%20scalar.
Next, configure the options of data source by providing:
Here is an example that demonstrates how this is done: https://www.mathworks.com/help/database/ug/databaseconnectionoptions.html.
Once the connection is established, ‘fetch’ command can be used to access data from the database. For guidance on how this is accomplished, here is a link to the documentation: https://www.mathworks.com/help/database/ug/database.odbc.connection.fetch.html.
Hope it helps!
0 Comments
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!