cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

[Simba][SparkJDBCDriver](500177) Error getting http path from connection string

ClaudeR
New Contributor III

I'm trying to use a very basic java program to connect to Databricks using spark jdbc driver (SparkJDBC42.jar), but I get the error (mentioned above):

[Simba][SparkJDBCDriver](500177) Error getting http path from connection string

Here is my code snippet:

import java.sql.*;
class JDBCTest
{
    public static void main(String args[]) throws SQLException
    {
        Connection con = null;
        try
        {
            Class.forName("com.simba.spark.jdbc.Driver");
            String dbURL = "jdbc:spark://dbc-29cb99e0-2b6f.cloud.databricks.com:443/default;transportMode=http;ssl=1;AuthMech=3";
            System.out.println("jdbcurl=" + dbURL);
            String strUserID = "User1@mail.com";
            String strPassword = "Password#1";
            con=DriverManager.getConnection(dbURL,strUserID,strPassword);
            System.out.println("Connected to the database.");
            Statement stmt=con.createStatement();
            System.out.println("Executing query");
            ResultSet rs=stmt.executeQuery("SELECT * FROM default.table1");
            while(rs.next())
                System.out.println("1");
            con.close();
        }catch(Exception e){ System.out.println(e);}
        finally
        {
            con.close();
        }
    }
}

Running command: java -cp SparkJDBC42.jar:. JDBCTest "test"

I'm using the jdbc url provided for my connection endpoint.

This same code works for other databases.

It seems to be with the Spark driver that doesn't allow me to even reach the point at which I attempt to connect.

Your help is appreciated. Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

ClaudeR
New Contributor III

I found my issue. I was missing the httpPath in the URL. That fixed it.

View solution in original post

2 REPLIES 2

ClaudeR
New Contributor III

I found my issue. I was missing the httpPath in the URL. That fixed it.

Anonymous
Not applicable

Hello @Claude Reponoโ€‹ 

Thank you for posting your question in the community. It seems you were able to find the solution by yourself. That's awesome. We are going to go ahead and mark your answer as the best solution.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group