How to load table from SQL server using H2o in R?

孤街醉人 提交于 2019-12-04 15:15:17

You need a supported JDBC (Build on JDBC 42 Core) driver to connect from H2O to SQL Server. You can download Microsoft JDBC Driver 4.2 for SQL Server from the link below first:

https://www.microsoft.com/en-us/download/details.aspx?id=54671

After that please follow the article below to first test JDBC driver from R/Python H2O client and then connect to your database:

https://aichamp.wordpress.com/2017/03/20/building-h2o-glm-model-using-postgresql-database-and-jdbc-driver/

Above article is for postgres however you can use it with SQL server using an appropriate driver.

For Windows, remember to use ; instead : for the -cp argument.

java -Xmx4g -cp sqljdbc42.jar;h2o.jar water.H2OApp -port 3333

water.H2OApp is the main class in h2o.jar.

Important Note: SQL Server is not supported so far( August/2017). You may use MariaDB to load datasets:

From Windows console:

java -Xmx4G -cp mariadb-java-client-2.1.0.jar;h2o.jar water.H2OApp -port 3333

Note. For Linux, replace ";" with ":"

From R:

sqlConn <- "jdbc:mariadb://10.106.7.46:3306/DBName"
userName <- "dbuser"
userPass <- "dbpass."
sql_Query <- "SELECT * FROM dbname.tablename;"
mydata <- h2o.import_sql_select( sqlConn, sql_Query, userName, userPass )
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!