how to connect mysql databases in weka?

China☆狼群 提交于 2019-12-05 18:21:10
houssam

add mysql-connector-java-5.1.12-bin.jar to CLASSPATH . or put it in weka folder, navigate to weka installation folder and run command :

%java_home%/bin/java -Xmx300M -cp ".;weka.jar;mysql-connector-java-5.1.12-bin.jar;" weka.gui.GUIChooser

then click open DB and

  • fill in the proper user+password
  • put the url: jdbc:mysql://localhost:3306/DATABASENAME

Click Execute. The result window should show the results now.

For Weka 3.7.10, the classpath system environment variable is not took into account (at leat under Windows 7). The only working approach for me was to modify the RunWeka.ini file from the Weka installation folder as follows: the cp= setting was modified to:

cp=%CLASSPATH%;d:/Programs/jdbc/mysql-connector-java-5.1.26/mysql-connector-java-5.1.26-bin.jar

whereas only the %CLASSPATH%; setting was originally provided. Does not make much sense, but in worked.

find some introduction to WEKA and the environment variable: http://weka.wikispaces.com/CLASSPATH

Copy mysql-connector-java-X.X.XX-bin.jar to /usr/share/java/ unizip /usr/share/java/weka.jar

edit: /usr/share/java/weka/experiment/DatabaseUtils.props

add: jdbcDriver=com.mysql.jdbc.Driver jdbcURL=jdbc:mysql://localhost:3306/test (with your server)

add shell export CLASSPATH=/usr/share/java/mysql-connector-java-X.X.XX-bin.jar: export CP=/usr/share/java/mysql-connector-java-X.X.XX-bin.jar::/usr/share/java/:/usr/shared/java/weka.jar

execute weka:

java -cp $CP -Xmx500m weka.gui.explorer.Explorer

Ready

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!