我試圖連接到磚使用java代碼。誰能幫我個忙嗎?這是到目前為止我的代碼有::
進口java.sql.Connection;進口java.sql.DriverManager;進口java.sql.SQLException;進口java.util.Properties;公開課DatabricksSetup{公共靜態空main (String [] args) throws SQLException{字符串url = " jdbc:磚:/ / XXXX.azuredatabricks.net: 443 /違約;運輸方式= http; ssl = 1; httpPath = sql / protocolv1 / o / XXXXX; AuthMech = 3; UID =令牌;PWD = XXXXXX”;字符串的用戶名=“令牌”;字符串密碼=“XXXX”;/ /生成令牌從磚概要文件的頁麵。= DriverManager連接連接。getConnection (url、用戶名、密碼); System.out.println("Database connected!"); if(connection != null){ System.out.println("Connection Established"); } else { System.out.println("Connection Failed"); } } }
下麵的依存關係已經補充道:
“com.databricks: databricks-jdbc: 2.6.25”
錯誤:
異常的線程java.sql“主要”。SQLException異常(磚):[DatabricksJDBCDriver](500593)通信鏈路故障。無法連接到服務器。原因:HTTP響應代碼:403,錯誤信息:未知。
在com.databricks.client.hivecommon.api.HS2Client。handleTTransportException(未知來源)
在com.databricks.client.spark.jdbc.DowloadableFetchClient。handleTTransportException(未知來源)
在com.databricks.client.hivecommon.api.HS2Client。openSession(未知來源)
在com.databricks.client.hivecommon.api.HS2Client。< init >(未知源)
在com.databricks.client.spark.jdbc.DowloadableFetchClient。< init >(未知源)
在com.databricks.client.spark.jdbc.DownloadableFetchClientFactory。createClient(未知來源)
在com.databricks.client.hivecommon.core.HiveJDBCCommonConnection。connectToServer(未知來源)
在com.databricks.client.spark.core.SparkJDBCConnection。connectToServer(未知來源)
com.databricks.client.hivecommon.core.HiveJDBCCommonConnection.establishConnection(未知源)
com.databricks.client.spark.core.SparkJDBCConnection.establishConnection(未知源)
在com.databricks.client.jdbc.core.LoginTimeoutConnection。連接(未知來源)
com.databricks.client.jdbc.common.BaseConnectionFactory.doConnect(未知源)
com.databricks.client.jdbc.common.AbstractDriver.connect(未知源)
java.sql.DriverManager.getConnection (DriverManager.java: 664)
java.sql.DriverManager.getConnection (DriverManager.java: 247)
在digital.eComm.ui.tests.DatabricksSetup.main (DatabricksSetup.java: 16)
引起的:com.databricks.client.support.exceptions。ErrorException(磚):[DatabricksJDBCDriver](500593)通信鏈路故障。無法連接到服務器。原因:HTTP響應代碼:403,錯誤信息:未知。
…16日更