From http://blogger.org.cn/blog/more.asp? Name = dmman and ID = 24991
Take SQL Server2000 as an example to use the JDBC-ODBC bridge. Other database operations are the same, with different details.
1. You do not need to install the driver in the JDBC-ODBC bridge mode. We will create a data source in the management tool.
2. Modify the databaseutils. Props file under WEKA \ experiment.
********************
Decompress WEKA. jar in the WEKA installation directory and you will see the WEKA \ Experiment \ databaseutils. Props directory.
********************
We can see databaseutils. Props. ODBC; databaseutils. Props. Oracle, etc.
Change databaseutils. Props to another name, and then change databaseutils. Props. MSSQLServer to databaseutils. Props,
Open the current databaseutils. Props and you will see the following)
2.1 driver Loading
# JDBC Driver (comma-separated list)
Jdbcdriver = sun. JDBC. ODBC. jdbcodbcdriver
2.2 database connection
# Database URL
Jdbcurl = JDBC: ODBC :( here is the name of the data source you created)
2.3 data type conversion. WEKA only supports nominal, numeric, string, and date ). Therefore, we need to map the data types in the current database to these four types.
Remove the comments in front of the sentence corresponding to the following data types. SQL Server2000 has other data types that cannot be identified by WEKA, so we will add
Smallint = 3
Datetime = 8, etc.
String, getstring () = 0; --> nominal
Boolean, getboolean () = 1; --> nominal
Double, getdouble () = 2; --> numeric
Byte, getbyte () = 3; --> numeric
Short, getbyte () = 4; --> numeric
Int, getinteger () = 5; --> numeric
Long, getlong () = 6; --> numeric
Gloat, getfloat () = 7; --> numeric
Date, getdate () = 8; --> date
Varchar = 0
Float = 2
Tinyint = 3
Int = 5
3. I don't need to worry about it for the moment (I don't understand it very well ...)
# Other options
Create_double = Double Precision
Create_string = varchar (8000)
Create_int = int
Checkuppercasenames = false
Checklowercasenames = false
Checkfortable = true
********************
Note that WEKA must be read when the WEKA software is running. Jar, so after modification, you need to re-package the JAR file and replace the original jar to run WEKA software to connect to the database.
********************
4 OK. You can perform the following operations! After running WEKA's javase interface, open the SQL viewer working interface through open dB... (3.5.5 is much more refined than 3.4.10 ).
With user, we can connect after setting the user name and password;
After the connection is successful, you can write an SQL statement to query the desired result,
OK. You can see the input data in the preprocoss Panel of the explore interface.
********************
When the query results are returned, an error may occur when the "OK" command is used to import the explore file, indicating that a data type cannot be identified. In this case, check whether the data type is added to Step 2.3.
********************
When connecting to read database data, the SQL viewer Panel also provides info, which is equivalent to debugging information when we connect to the database simply using JDBC.
The following is my SQL Server 2000 database configuration file.
Databaseutils.rar