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.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!