cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.