Weka Connecting MySQL Database

Source: Internet
Author: User
Tags mysql in

First, download and unzip the database driver

: http://www.mysql.com/products/connector/, this article downloads mysql-connector-java-5.0.8.zip. Copy the extracted Mysql-connector-java-5.0.8-bin.jar to the D:\Program Files\weka-3-6\lib (Lib creates a new folder for itself).

Second, set environment variables

Weka_home:d:\program files\weka-3-6

Classpath:%weka_home%\lib\mysql-connector-java-5.0.8-bin.jar

Third, modify the Weka.jar

1. Extract Weka.jar to a directory (package here)

2, in D:\Program files\weka-3-6\package\weka\ Find DatabaseUtils.props.mysql in experiment, change its name to Databaseutils.props, replace the original Databaseutils.props file, and modify the corresponding content in the file as follows:

# JDBC Driver (comma-separated list)
Jdbcdriver=com.mysql.jdbc.driver

# database URL
Jdbcurl=jdbc:mysql://localhost:3306/db_predict (db_predict for database name)

# specific data types, remove comment, change to Weka supported format
string, getString () = 0;     Nominal
Boolean, getboolean () = 1; --Nominal
Double, getdouble () = 2;  & nbsp --Numeric
Byte, getbyte () = 3;       --Numeric
Short, getbyte () = 4 ;       -numeric
int, getinteger () = 5;     - Numeric
Long, getlong () = 6;       --Numeric
Float, getfloat () = 7 ;     -Numeric
Date, getDate () = 8;       -- > Date
Text, getString () = 9;     , String
Time, getTime () = 10;  & nbsp;   --Date
Bigdecimal,getbigdecimal () =11;  -->nominal  

#mysql-conversion-type conversion, do the following supplement
Tinyint=3
Smallint=4
Short=5
Integer=5
Int=5
Int_unsigned=6
Bigint=6
Long=6
Real=7
numeric=2
decimal=2
float=2
double=2
Char=0
Text=0
Varchar=0
Longvarchar=9
Binary=0
Varbinary=0
Longvarbinary=9
Bit=1
Blob=8
Date=8
Time=8
Datetime=8
Timestamp=8

3, RePack. The command line enters D:\Program Files\weka-3-6\package, executes the command: Jar CVF weka.jar Java_cup meta-inf Weka, replacing the original Weka.jar.

Four, running Weka

Click explorer>> click Open db>> Click user>> Enter user name, password >> Click Connect

Represents success

Weka Connecting MySQL Database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.