sql-server - Pentaho水壶: cannot connect to MS SQL Server Express

标签 sql-server jdbc pentaho kettle

我的本​​地计算机(Windows 7 PC)上正在运行 Microsoft SQL Server 2014 Express。

我使用 Python,并且可以使用 SQL alchemy 连接到服务器(从同一台 PC),没有任何问题。我还可以使用 Excel 和 PowerPivot 加载项进行连接。

但是,我无法与 Pentaho - Kettle 连接。

  • 我已从 Microsoft 下载了 JDBC 驱动程序: https://www.microsoft.com/en-gb/download/details.aspx?id=11774
  • 我将文件 jre8\sqljdbc42.jar 移至以下目录的 lib 子文件夹中 Pentaho 数据集成安装。我把文件放在jre8中,而不是jre7中,因为我的Java是JRE1.8.0_144
    • 然后我将文件放入 auth\x86\sqljdbc_auth.dll并将其复制到同一个 lib 文件夹中。我采用了x86文件,而不是x64,因为Java位于c:\Program Files (x86)\Java\jre1.8.0_144\
    • 我添加“表输入”并设置连接类型= MS SQL Server( native )和 Access = native (JDBC)

我收到的错误消息是:

Error connecting to database [mydatabase] :org.pentaho.di.core.exception.KettleDatabaseException:  Error occurred while trying to connect to the database

Error connecting to database: (using class com.microsoft.sqlserver.jdbc.SQLServerDriver) The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".


org.pentaho.di.core.exception.KettleDatabaseException:  Error occurred while trying to connect to the database

Error connecting to database: (using class com.microsoft.sqlserver.jdbc.SQLServerDriver) The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".

我尝试了指定端口号 1433 并将其留空、使用集成安全性和手动输入密码、将主机名设置为 localhost 和 DESKTOP-MYNAME\SQLEXPRESS 的各种组合,但均无济于事。

我读过很多关于它的讨论,但似乎没有一个相关; SQL Server 确实接受传入连接,例如来自 Python 和 SQL Alchemy。

最佳答案

我运行了 SQL Server 2014 配置管理器,并检查了:

SQL Server 网络配置 --> SQLEXPRESS 协议(protocol) --> TCP/IP

在协议(protocol)选项卡中,我有:启用:是和全部监听:是

在“IP 地址”选项卡中底部的 IPAll 下,“TCP 动态端口”设置为 49178。 (不知道为什么)。

所以我将 Pentaho 的“表输入”设置中的端口设置为 49178。它设法找到服务器,但集成安全性出现错误。因此,我将 sqljdbc_auth.dll 复制到 C:\Program Files (x86)\Java\jre1.8.0_144 .... 的 bin 和 lib 子文件夹中......现在它可以工作了!

如果我不指定端口,Pentaho 会尝试端口 1433,但它不起作用。

作为引用,我在 Python 和 SQL Alchemy 中使用的连接字符串没有显式指定端口。

params = '?driver=SQL+Server+Native+Client+11.0'
engine = create_engine('mssql+pyodbc://' + ServerName + '/'+ Database + params, encoding ='latin1' )
conn=engine.connect()

关于sql-server - Pentaho水壶: cannot connect to MS SQL Server Express,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48581898/

相关文章:

sql-server - 运行 MSsql 查询类似 foreach

jdbc - 预期 IllegalArgumentException : u'Wrong FS: file://spark-warehouse,:file:///'

java - ProGuard Android - JDBC 错误 - NullPointerException

http - 使用 Pentaho Kettle,我如何自动重试由于连接中断而失败的休息请求?

sql-server - SQL Server 2012 - 安装程序的 "Feature Selection"屏幕上不包含 Analysis Services

SQL根据多列值过滤搜索

sql-server - 查询优化器无法将谓词推过汇总?提示也不起作用

mysql - 克罗贾尔 JDBC : How to Use Pooled Connection for Query

java - SQL Server 短暂登录失败 "Cannot open database "**** *"requested by the login. The login failed."

hadoop - 商业智能中的 Spark