簡體   English   中英

我如何從Scala連接到Exasol?

[英]How do I connect to Exasol from Scala?

我想使用Scala連接到ExaSol數據庫。 我可以使用pyodbc在Python中連接到數據庫,但在Scala中嘗試使用JDBC驅動程序進行連接時收到以下錯誤:

scala> :require /Users/some/path/mssql-jdbc-7.4.0.jre8.jar
scala> Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
scala> import java.sql.{Connection, DriverManager, ResultSet}
scala> val conn = DriverManager.getConnection("jdbc:sqlserver://11.11.11.11:8563;databaseName=some-db;user=user_name;password=pass_word;useUnicode=true;characterEncoding=UTF-8")
Sep 11, 2019 1:38:55 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: a03dede8-7f9c-495d-83d5-4986b859e1e9 Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
Sep 11, 2019 1:38:55 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: ea705538-c0c9-4bc3-ba66-9630e7850b58 Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
Sep 11, 2019 1:39:09 PM com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin
WARNING: ConnectionID:2 ClientConnectionId: 5238ac7c-55cc-4ec2-a070-d7f454c6c43b Prelogin error: host 11.11.11.11 port 8563 Unexpected end of prelogin response after 0 bytes read
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 11.11.11.11, port 8563 has failed. Error: "The driver received an unexpected pre-login response. Verify the connection properties and check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. This driver can be used only with SQL Server 2005 or later.". ClientConnectionId:5238ac7c-55cc-4ec2-a070-d7f454c6c43b
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2924)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2913)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection.java:2655)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2480)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2142)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1993)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1164)
  at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:760)
  at java.sql.DriverManager.getConnection(DriverManager.java:664)
  at java.sql.DriverManager.getConnection(DriverManager.java:270)
  ... 28 elided

請嘗試使用“ com.exasol.jdbc.EXADriver”驅動程序。

該文檔位於以下網址中:

https://docs.exasol.com/connect_exasol/drivers/jdbc.htm

暫無
暫無

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

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