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