簡體   English   中英

如何使用 spring 啟動建立 Microsoft azure databricks 增量表連接,就像 mysql,ZAC5C74B61AFFB4BAC28 服務器一樣

[英]How to establish a Microsoft azure databricks delta tables connection using spring boot just like mysql,sql server

Hi I want to establish a connection with the Microsoft azure databricks delta table inside my spring boot application.I have the cluster url,username and the password(token) of the delta table from which I need to pull the data to my application. 請對此有所了解

您可以使用 JDBC 訪問集群和基礎表(請參閱文檔)。 您需要獲取相應的驅動程序,並將其添加到您的應用程序中,然后使用普通的 JDBC API ,如下所示:

String jdbcConnectPassthroughCluster = "jdbc:spark://<server-hostname>:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/0/xxxx-xxxxxx-xxxxxxxx;AuthMech=3;UID=token;PWD=";

String PATH = "<personal token>"
String JDBC_DRIVER = "com.simba.spark.jdbc.Driver";
String DB_URL = jdbcConnectPassthroughCluster + PAT;

Class.forName(JDBC_DRIVER);
System.out.println("Getting connection");
Connection conn = DriverManager.getConnection(DB_URL);
Statement stmt = conn.createStatement();
System.out.println("Going to execute query");
ResultSet rs = stmt.executeQuery("select * from table");
System.out.println("Query is executed");
int i = 0;
while(rs.next()) {
    System.out.println("Row " + i + "=" + rs.getLong(1));
    i++;
}
rs.close();
stmt.close();
conn.close();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM