如何使用 JDBC 驱动程序连接到 Databricks Delta table
How to Connect to Databricks Delta table using JDBC driver
如何使用 JDBC 连接到 Databricks Delta table?
我已经尝试连接 simba 驱动程序,但我很难获得驱动程序 class 名称和 url 配置。
感谢任何解决方案。
我无法在此处粘贴代码作为其公司代码。
提前致谢。
检查下面的 link。这有使用 JDBC
配置增量的步骤
http://sedeks.blogspot.com/2019/05/how-to-connect-to-databricks-delta.html
此 link 中提供的代码:
import java.sql.DriverManager
import java.sql.Driver
import java.sql.Connection
import javax.sql.DataSource
object ScalaJdbcConnectSelect {
def main(args: Array[String]) {
val driver = "com.simba.spark.jdbc41.Driver" //attach the Spark jar to the Classpath.
val url = "jdbc:spark://field-eng.cloud.databricks.com:443/default;transportMode=http;ssl=true;httpPath=sql/protocolvl/o/0/0911-153027-hopes19";
val username = "token"
val password = "<token-value>" //Token generated from databricks profile page.
var connection:Connection = null
try {
// Create the connection
Class.forName(driver)
connection = DriverManager.getConnection(url, username, password)
if(connection != null){
println("Connection Established");
}
else {
println("Connection Failed");
}
// create the statement
val statement = connection.createStatement()
val resultSet = statement.executeQuery("<<Query>") // Profile your query here.
while ( resultSet.next() ) {
// Iterate through Result set
}
catch {
case e => e.printStackTrace
}
connection.close()
}
}
如何使用 JDBC 连接到 Databricks Delta table?
我已经尝试连接 simba 驱动程序,但我很难获得驱动程序 class 名称和 url 配置。
感谢任何解决方案。 我无法在此处粘贴代码作为其公司代码。
提前致谢。
检查下面的 link。这有使用 JDBC
配置增量的步骤http://sedeks.blogspot.com/2019/05/how-to-connect-to-databricks-delta.html
此 link 中提供的代码:
import java.sql.DriverManager
import java.sql.Driver
import java.sql.Connection
import javax.sql.DataSource
object ScalaJdbcConnectSelect {
def main(args: Array[String]) {
val driver = "com.simba.spark.jdbc41.Driver" //attach the Spark jar to the Classpath.
val url = "jdbc:spark://field-eng.cloud.databricks.com:443/default;transportMode=http;ssl=true;httpPath=sql/protocolvl/o/0/0911-153027-hopes19";
val username = "token"
val password = "<token-value>" //Token generated from databricks profile page.
var connection:Connection = null
try {
// Create the connection
Class.forName(driver)
connection = DriverManager.getConnection(url, username, password)
if(connection != null){
println("Connection Established");
}
else {
println("Connection Failed");
}
// create the statement
val statement = connection.createStatement()
val resultSet = statement.executeQuery("<<Query>") // Profile your query here.
while ( resultSet.next() ) {
// Iterate through Result set
}
catch {
case e => e.printStackTrace
}
connection.close()
}
}