DatabaseUtils.props problem

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

DatabaseUtils.props problem

Áthila Rocha Trindade

I'm now trying to connect Weka to Mysql database. But after I select data in
SQl-viewer and press "Ok" I get this error:

> couldn't read from database unknown data type: INT. Add Entry in
> weka/experiment/DatabaseUtils.props.
> If the type contains blanks, either escape them with a backslash or
> use underscores instead of blanks.


> I read several treads about this error but still cannt find out what
> is wrong. I would be great if someone take a look at my
> DatabaseUtils.props and give me a hint what is wrong
>
Here is my DatabaseUtils.props:

# General information on database access can be found here:
# http://weka.wikispaces.com/Databases
#
# Version: $Revision: 5836 $

# The comma-separated list of jdbc drivers to use
#jdbcDriver=RmiJdbc.RJDriver,jdbc.idbDriver
#jdbcDriver=jdbc.idbDriver
jdbcDriver=RmiJdbc.RJDriver,jdbc.idbDriver,org.gjt.mm.mysql.Driver,com.mckoi.JDBCDriver,org.hsqldb.jdbcDriver
#jdbcDriver=org.gjt.mm.mysql.Driver

# The url to the experiment database
#jdbcURL=jdbc:rmi://expserver/jdbc:idb=experiments.prp
jdbcURL=jdbc:idb=experiments.prp
jdbcURL=jdbc:mysql://localhost:3306/teste

#the method that is used to retrieve values from the db
# (java datatype + RecordSet.<method>) string, getString() = 0; --> nominal
boolean, getBoolean() = 1; --> nominal
double, getDouble() = 2; --> numeric byte, getByte() = 3; --> numeric
short, getByte()= 4; --> numeric
int, getInteger() = 5; --> numeric INT, getInteger() = 5; INT(11), getInteger() = 5; -->numeric INT., getInteger() = 5; -->numeric long, getLong() = 6; --> numeric float, getFloat() = 7; --> numeric
date, getDate() = 8; --> date text, getString() = 9; --> string
time, getTime() = 10; --> date
# the original conversion: <column type>=<conversion>
char=0
varchar=0longvarchar=0
binary=0 varbinary=0longvarbinary=0bit=1
numeric=2decimal=2tinyint=3smallint=4INT=5integer=5bigint=6real=7
float=2double=2
date=8
time=10
timestamp=8 mysql-conversion
CHAR=0
TEXT=0
VARCHAR=0
LONGVARCHAR=9
BINARY=0
VARBINARY=0LONGVARBINARY=9
BIT=1
NUMERIC=2
DECIMAL=2
FLOAT=2
DOUBLE=2
TINYINT=3
SMALLINT=4 SHORT=4
SHORT=5
INTEGER=5
BIGINT=6
LONG=6
REAL=7
DATE=8
TIME=10
TIMESTAMP=8

#mappings for table creation
CREATE_STRING=TEXT
CREATE_INT=INT
CREATE_DOUBLE=DOUBLE
CREATE_DATE=DATETIME
DateFormat=yyyy-MM-dd HH:mm:ss

#database flags
checkUpperCaseNames=false
checkLowerCaseNames=false
checkForTable=true
setAutoCommit=true
createIndex=false

# All the reserved keywords for this database
Keywords=\
AND,\
ASC,\
BY,\
DESC,\
FROM,\
GROUP,\
INSERT,\
ORDER,\
SELECT,\
UPDATE,\
WHERE

# The character to append to attribute names to avoid exceptions due to
# clashes between keywords and attribute names
KeywordsMaskChar=_

#flags for loading and saving instances using DatabaseLoader/Saver
nominalToStringLimit=50
idColumn=auto_generated_id





 
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: DatabaseUtils.props problem

mhall
Administrator
On 02/23/2011 04:35 PM, Áthila Rocha Trindade wrote:
> /
> I'm now trying to connect Weka to Mysql database. But after I select data in
> //  SQl-viewer and press "Ok" I get this error:
> //
> />/  couldn't read from database unknown data type: INT. Add Entry in
> />/  weka/experiment/DatabaseUtils.props.
> />/  If the type contains blanks, either escape them with a backslash or
> />/  use underscores instead of blanks.


Just take the DatabaseUtils.props.mysql included with Weka, add a line:

INT=5

and then rename the file to DatabaseUtils.props.

Cheers,
Mark.

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

DatabaseUtils.props problem

jiyas
In reply to this post by Áthila Rocha Trindade

Hi,

remove the comment for the appropriate data type and methods in prop file
eg:
my data type is varchar,so i focused only on varchar
previous:

#string, getString() = 0;    --> nominal
#varchar=0

later

string, getString() = 0;    --> nominal
varchar=0



_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.scms.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: DatabaseUtils.props problem

dwivedi
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: DatabaseUtils.props problem

Eibe Frank-2
Administrator
It sounds like WEKA cannot find the .props file when you run it in tomcat. There is some info on where WEKA looks for .props files on the following page:

  https://weka.wikispaces.com/Properties+File

Cheers,
Eibe

> On 19/06/2017, at 6:29 PM, dwivedi <[hidden email]> wrote:
>
> I am using Weka API's in my JSP servlet based web application. When I deploy
> using eclipse, the weka generates the correct output. But when I deploy the
> war file in tomcat separately and try to run , without running from eclipse,
> the weka gives some error like "java.lang.IllegalArgumentException: Unknown
> data type: varchar. Add entry in weka/experiment/DatabaseUtils.props."
>
> Here is my DatabaseUtil.props file
>
> # General information on database access can be found here:
> # http://weka.wikispaces.com/Databases
> #
> # Version: $Revision: 5836 $
>
> # The comma-separated list of jdbc drivers to use
> #jdbcDriver=RmiJdbc.RJDriver,jdbc.idbDriver
> #jdbcDriver=jdbc.idbDriver
> #jdbcDriver=RmiJdbc.RJDriver,jdbc.idbDriver,org.gjt.mm.mysql.Driver,com.mckoi.JDBCDriver,org.hsqldb.jdbcDriver
> #jdbcDriver=org.gjt.mm.mysql.Driver
>
> jdbcDriver=org.postgresql.Driver
>
> # The url to the experiment database
> #jdbcURL=jdbc:rmi://expserver/jdbc:idb=experiments.prp
> #jdbcURL=jdbc:idb=experiments.prp
> #jdbcURL=jdbc:mysql://mysqlserver/username
>
> jdbcURL=jdbc:postgresql://localhost:5432/sample_db?user=postgres&password=postgres
> # URL for  DB server
>
> # the method that is used to retrieve values from the db
> # (java datatype + RecordSet.<method>)
> 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
> # float, getFloat() = 7;      --> numeric
> # date, getDate() = 8;        --> date
> # text, getString() = 9;      --> string
> # time, getTime() = 10;       --> date
> # the original conversion: <column type>=<conversion>
> #char=0
> varchar=0
> #longvarchar=0
> #binary=0
> #varbinary=0
> #longvarbinary=0
> #bit=1
> numeric=2
> #decimal=2
> #tinyint=3
> #smallint=4
> #integer=5
> #bigint=6
> #real=7
> #float=2
> #double=2
> #date=8
> #time=10
> #timestamp=8
> #mysql-conversion
> CHAR=0
> TEXT=0
> #VARCHAR=0
> LONGVARCHAR=9
> BINARY=0
> VARBINARY=0
> LONGVARBINARY=9
> BIT=1
> NUMERIC=2
> DECIMAL=2
> FLOAT=2
> DOUBLE=2
> TINYINT=3
> SMALLINT=4
> #SHORT=4
> SHORT=5
> INTEGER=5
> BIGINT=6
> LONG=6
> REAL=7
> DATE=8
> TIME=10
> TIMESTAMP=8
>
> #mappings for table creation
> CREATE_STRING=TEXT
> CREATE_INT=INT
> CREATE_DOUBLE=DOUBLE
> CREATE_DATE=DATETIME
> DateFormat=yyyy-MM-dd HH:mm:ss
>
> #database flags
> checkUpperCaseNames=false
> checkLowerCaseNames=false
> checkForTable=true
> setAutoCommit=true
> createIndex=false
>
> # All the reserved keywords for this database
> Keywords=\
>  AND,\
>  ASC,\
>  BY,\
>  DESC,\
>  FROM,\
>  GROUP,\
>  INSERT,\
>  ORDER,\
>  SELECT,\
>  UPDATE,\
>  WHERE
>
> # The character to append to attribute names to avoid exceptions due to
> # clashes between keywords and attribute names
> KeywordsMaskChar=_
>
> #flags for loading and saving instances using DatabaseLoader/Saver
> nominalToStringLimit=50
> idColumn=auto_generated_id
>
>
>
>
> --
> View this message in context: http://weka.8497.n7.nabble.com/DatabaseUtils-props-problem-tp13725p40986.html
> Sent from the WEKA mailing list archive at Nabble.com.
> _______________________________________________
> Wekalist mailing list
> Send posts to: [hidden email]
> List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
> List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
List info and subscription status: https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html