Java application connection to dremio using dremio jdbc driver

I am new to dremio. I am trying to connect to dremio host using JDBC driver and fetch the SQL query output.

I have created a demo lab setup for this purpose and added sample data. I am trying below approach to connect:

    final String DB_URL = "jdbc:dremio:direct=//9047-<rest part of url>;";
    final String USER = "user";
    final String PASS = "password";
    Properties props = new Properties();

    Connection conn = null;
    Statement stmt = null;
    try {

        conn = DriverManager.getConnection(DB_URL, props);

        stmt = conn.createStatement();

        String sql;
        sql = "SELECT * FROM incidents limit 5;";
        ResultSet rs = stmt.executeQuery(sql);
        HashMap<String, String> map = getResultSet(rs);
    } catch (SQLException se) {

I am running the application using the below command.

java -cp 20.0.0-202201050826310141-8cc7162b.jar

But I am getting the below error:

“No Suitable driver found for jdbc:dremio:direct=//;”

If someone can answer the above, it will be very helpful.

Hi @Abhi,

You need to have the JDBC driver in the classpath of the application that you’re running, otherwise it will not be found. An example command is shown in the header comments from, and java - Adding jdbc driver to classpath - Stack Overflow also has some additional instructions.