1
import java.sql.*;

public class GridDBConnectionTest {
    public static void main(String[] args) {
        try {
            Class.forName("com.toshiba.mwcloud.gs.sql.Driver");
            Connection conn = DriverManager.getConnection("jdbc:gs://localhost:10001/my_container");
            System.out.println("Connected to GridDB database.");
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

I am trying to establish a connection to a GridDB time series database from my Ubuntu machine using JDBC. However, when running the above code, I encounter an error and the connection fails. The error message I receive is: "java.lang.ClassNotFoundException: com.toshiba.mwcloud.gs.sql.Driver". I have already added the necessary GridDB JDBC driver to the classpath. What could be causing this error and how can I successfully connect to the GridDB database using JDBC?

John Woods
  • 71
  • 2

0 Answers0