Question

WEKA Explorer can't open a connection to MySQL.

connecting to: jdbc:mysql://MYSERVER:3306/NAME = true

by the way: mysql driver was downloaded mysql-connector-java-5.1.14-bin & classpath was set.

(User & Pass are ok because it works with MySQL Workbench)

when clicking on the JButton OK (in the form 'Open DB'), then a message box shows an error - see image:

Error Message

(screen shot shows infamous "no driver" error)

weka version is 3.6.3.

any suggestions ?

Was it helpful?

Solution

Wasted half an hour on this same problem, here's the answer:

Download the connector from http://dev.mysql.com/downloads/connector/j/

Extract the JAR file.

Edit C:\Program Files\Weka-3-6\RunWeka.ini

Change last line to:

cp=%CLASSPATH%;c:/mysql-connector-java-5.1.16-bin.jar

You may of course save your mysql-connector jar to a different path, but mind the forward slash, nevermind being on Windows.

OTHER TIPS

I solved this problem along the day. The solution took me hours. If you are in ubuntu or debian-based linux, first install mysql-connector-java with:

sudo apt install libmysql-java

It will install mysql-connector-java-* links in /usr/share/java/mysql-connector-java.jar

#!/bin/bash
# Path to weka.jar
CP=$CLASSPATH:/usr/share/java/:/usr/share/java/weka.jar:/usr/share/java/mysql-connector-java.jar
# start Explorer
java -cp $CP -Xmx500m weka.gui.GUIChooser

I replaced /usr/bin/weka with the script above. Maybe could save hours for people like me. Another option is edit your desktop menu with:

java -cp "/usr/share/java/mysql.jar:/usr/share/java/weka.jar" -Xmx500m weka.gui.GUIChooser

(in my case mysql.jar links the correct version of the driver)

After you're done with CLASSPATH variable, You might need to create a "DatabaseUtlils.props" file and add following line in it,

jdbcDriver=com.mysql.jdbc.Driver

and import it in Weka under "switch database setup"

Cheers!

Actually and can extract the source jar and import into eclipse maven and add the Mysql dependency in the pom.xml , than run maven build with parameters "clean install" , once it is finished you will have alot of errors you can ignore them those are JUnit testing and than run project as a Java Application and use the GUI class "weka.gui.GUIChooser" add the connection string and smooth sailing.

pom.xml add:

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <version>5.1.36</version>
</dependency>

After maven install in complete. ![enter image description here][5] Click the explorer and Add your connection string , username and password jdbc:mysql://ip:port/databasename ![enter image description

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top