When trying to connect H2O to SQL Server 2016 to import a table, H2O returns a SQL Exception relating to FETCH Statement.
Environment:
- Ubuntu VM running H2O Version 3.22.0.2
- Windows instance with SQL Server 2016
JDBC Driver/s tested: MSSQL-jdbc-7 , MSSQL-jdbc-6.2.1 and sqljdbc4
ERROR MESSAGE: SQLException: Invalid usage of the option NEXT in the FETCH
statement. Failed to connect and read from SQL database with connection_url:
jdbc:sqlserver://<IP_ADDRESS>:1433;databaseName=DataStage;
Any ideas on what can be done to fix this?
Edit: Query used:
importSqlTable {"connection_url":"jdbc:sqlserver://<IP_ADDRESS>:1433;databaseName=DataStage;","table":"dbo.TestTable","columns":"","username":"xxxx","password":"XXXX"}
Edit 2: this is a clean install of H2O, so if there is any extra configuration that is meant to be done other than adding the driver/s to the class path, pointing me to the relevant documentation would be appreciated.
Edit 3: I've used a db tool (DBVisualiser) on the Ubuntu instance with the MSSQL-7 driver to confirm that the VM can connect to the SQL server, whilst H20 can't connect.
2条答案
按热度按时间ikfrs5lh1#
This looks like a bug to me. Do you happen to have the H2O log? It should have the full exception which could tell us what is wrong.
Please file a jira here: https://0xdata.atlassian.net/secure/Dashboard.jspa
We will look into it. Thank you for reporting this issue.
laik7k3q2#
Encountered the same problem. Ran a SQL Server Profiler to see what exactly H2O is trying to do. When you send a Table Parameter it ignores whatever you sent in select_query and it does this:
SELECT * FROM testTable FETCH NEXT 1 ROWS ONLY
The funny thing is that it doesn't validate the Table parameter in any way, so you can just initiate a comment after the table name:
table = "testTable --"
and it will produce the query below and import the data successfully :)
SELECT * FROM testTable -- FETCH NEXT 1 ROWS ONLY