代码之家  ›  专栏  ›  技术社区  ›  Pythonista anonymous

Pentaho Kettle:无法连接到MS SQL Server Express

  •  2
  • Pythonista anonymous  · 技术社区  · 8 年前

    我在本地计算机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\u 144
      • 然后我把文件收了进去 auth\x86\sqljdbc_auth.dll 并将其复制到同一个lib文件夹。我使用的是x86文件,而不是x64,因为Java在 c:\Program Files (x86)\Java\jre1.8.0_144\
      • 我添加了“表输入”,并将连接类型设置为MS SQL Server(本机)和Access=本机(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的连接。

    2 回复  |  直到 6 年前
        1
  •  5
  •   Pythonista anonymous    8 年前

    我运行了SQL Server 2014 configuration manager,并检查了:

    SQL Server网络配置-->SQLEXPRESS的协议-->TCP/IP

    在protocol选项卡中,我启用了:yes,并侦听了所有:yes

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

    所以我在Pentaho的“table input”设置中将端口设置为49178 . 它设法找到了服务器,但在集成安全方面出现了一个错误。所以我复制了sqljdbc\u auth。dll到C:\Program Files(x86)\Java\jre1.8.0\U 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()
    
        2
  •  0
  •   maQbex    5 年前

    SQL Server网络配置-->SQLEXPRESS的协议-->TCP/IP

    在protocol选项卡中,我启用了:yes,并侦听了所有:yes

    在“IP地址”选项卡的底部IPAll下,“TCP动态端口”设置为49178。

    因此,我在Pentaho的“table input”设置中将端口设置为49717。

    这对我也很管用。。

    推荐文章