PDA

View Full Version : connecter weka to mysql



helene0618
06-09-2009, 04:23 AM
hi,

i download the weka 3.6 et installe it. then i change the driver and url in the "databaseUtils.props", add the driver mysql-connector-java-5.0.4-bin.jar to weka\ where i instal the weka3.6. also add the classpath for exemple c:\programme systme\weka. then i run weka, connecte to my database, but it can't found the driver ? some one can tell me what's the problem.

thanks

helene

Mark
06-09-2009, 06:55 PM
Hi helene,

Did you add the full path to the mysql jar file to the %CLASSPATH% environment variable? Also, FYI there is an example .props file for mysql included in the weka-src.jar file in your Weka distribution. This file is called DatabaseUtils.props.mysql. You can rename it to DatabaseUtils.props, make changes for your setup and then move it to either your HOME directory or the Weka installation directory.

Cheers,
Mark.

helene0618
06-10-2009, 03:57 AM
thanks mark, i had try all the cas possible.

i changed the doc in weka.jar, renommer the databaseUtils.props to databaseUtils.props.old, then renommer databaseUtils.props.mysql to databaseUtils.props and change the driver and jdbcURL:
jdbcDriver=com.mysql.jdbc.Driver
jdbcURL=jdbc:mysql://localhost:3306/meteojob_

give an classpath in the variables environnement of propriété systeme:
C:\haihe\pentaho\Weka-3-6\mysql-connector-java-5.0.4-bin;

it does not work, so i also addid "set classpath=%classpath%;c:\haihe\pentaho\weka-3-6\mysql-connector-java-5.0.4-bin" into RunWeka.bat

always i does not work

now i change the weka-src.jar, do what you saied. always the same message "exception: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/meteojob_"

i don't know where is the problem. so now i use the PDI to get the arff, not pratical, but it work :)

helene

Mark
06-10-2009, 06:13 PM
Hi helene,

I've just tried Weka with the latest version of the mysql driver (5.1.7) and had no problems. I still think your classpath is the issue here (shouldn't there be ".jar" on the end of "c:\haihe\pentaho\weka-3-6\mysql-connector-java-5.0.4-bin"?).

The best way to check that the classpath is at fault is to cd to:

c:\haihe\pentaho\weka-3-6\

Make sure that your modified DatabaseUtils.props and mysql-connector-java-5.0.4-bin.jar is in this directory and then type:

java -cp weka.jar;mysql-connector-java-5.0.4-bin.jar weka.gui.explorer.Explorer

When you connect using the SQL-Viewer from Explorer's Preprocess panel, make sure that the URL is correct (i.e. it has loaded your DatabaseUtils.props file) and that you set a user and password (by clicking the "User" button) before connecting.

Cheers,
Mark.

helene0618
06-11-2009, 03:41 AM
thanks mark, cool, it works.

merciiiiiiiiiiii


helene

helene0618
06-12-2009, 03:32 AM
HI,
can we give more than one database URL in fiche databaseUtils.props?

helene

Mark
06-12-2009, 06:58 AM
You can't specify more than one URL in the props file. However, wherever there is a database URL prompt in Weka's GUI it will be populated by default with the value that is specified in the pops file - you can always type a new value in manually.

Cheers,
Mark.

helene0618
06-12-2009, 09:44 AM
ok, thanks

haihe