how to connect mysql databases in weka?

北城以北 提交于 2020-01-13 12:07:08

问题


i want to use my mysql databases in weka in order to analysis data. i download the mysql-connector-java-5.0.8-bin.jar and put that in weka folder in my program Files folder, and add this path to system variable path, but when i open the weka explorer and click the openDB, i don't know what should i write in the url textbox, i don't know completely what should i do? the error that i saw is:

problem connecting to database: no suitable driver found for!

please give me a total guidance, thanks in advance.


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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



来源:https://stackoverflow.com/questions/7083833/how-to-connect-mysql-databases-in-weka

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