PDA

View Full Version : Data base connection:classpath error



sijusony
09-16-2008, 12:45 AM
hi,


I am trying to use WEKA, i was able to take values from a CSS file using weka:),
but i was not able to take values from a database:confused:
in my console i am getting errors like drivers not found in classpath.......
even i changed my java classpath to point to weka folder........but even then it is not working....................is there any jar files that i need to include in classpath.................

mcbob
09-16-2008, 06:18 AM
hi,

try this link: http://weka.sourceforge.net/wiki/index.php/Databases
you will probably have to change the DatabaseUtils.props file and also get a jdbc driver according to your database type. and don't forget to include the driver jar file in your CLASSPATH.

sijusony
09-16-2008, 08:16 AM
hi,

I have already included the jar files files for all the drivers in the class path,
i think my problem is with 'DatabaseUtils.props' files because when i download the weka ithe file was not present........so afterwards i created the text file in the weka directory


can any one give me the format of the 'DatabaseUtils.props' file also were should i store this file in the weka directory or some where else

mcbob
09-16-2008, 09:21 AM
you can find all the DatabaseUtils.props files in the weka.jar or weka-src.jar.
just in case, .jar file is basicaly a ZIP archive that you can open with your favourite file compression software. you might need to rename it to weka.zip to be able to do that (don't forget to rename it back to weka.jar when you're finished).

in the weka.jar file, in the weka\experiment\ folder, you can find all the different DatabaseUtils.props files, e.g. DatabaseUtils.props.mssqlserver2005 or DatabaseUtils.props.mysql.

just copy the file that you need in your basic weka folder, e.g. C:\Program Files\Weka-3-5 and rename it to DatabaseUtils.props
then just change the jdbcURL in the file and it should work.

sijusony
09-17-2008, 08:22 AM
hi,

thank you for your replay

but still i am having some problems
i hav given the driver and url as
jdbcDriver-------- com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbcURL-----jdbc:sqlserver://infch02503:1433;DatabaseName=Mining


where Mining is My database name

but it was giving me errors when i try to use the sql query for for selecting the table

In the generic object editor i am giving the query like

select * from test
where test is the table name in Mining data base
but i am getting errors like
cannot read from database ----invalid object name test


even i tried with changing the jdbc url

jdbcURL-----jdbc:odbc:mining
where mining is the data source name i created for the Mining database

mcbob
09-17-2008, 11:44 AM
I suppose that you have MS SQL Server 2000. Try changing the jdbcURL to jdbc:microsoft:sqlserver:// etc.
if this doesn't help, I am out of ideas. sorry.