PDA

View Full Version : Anyone Successfully using weka to pull data from Oracle?



dougneedham
12-04-2008, 10:27 AM
It seems to me there are many hoops to jump through in order to simply pull data from Oracle.

I am apparently stuck trying to simply read data from oracle. I was able to get through the headache of connecting to Oracle.

Now I have this problem.

Weka is encountering a strange data type: VARCHAR2.


Has anyone else slayed this dragon?

I would expect some of this database stuff to be relatively simple. Just copy the ojdbc14.jar into your local path like you have to do in PDI or something like that and you are up and running.

I have seen email threads and posts that mention modifications to your CLASSPATH, modifications to a properties file, making sure you have a properties file in the correct location (USERPROFILE), updating the properties file so that you have data types set correctly, etc...

If anyone would assist me in getting this to work, I don't mind putting together a step-by-step HOWTO for weka to get this thing to simply read data from Oracle.

My expectation is that we should have something like this eventually:


Step1: install Weka.
Step2: copy ojdbc14.jar to local directory or specify jar location.
Step3: specify your SID and login details.
Step4: analysis/exploration/experimentation.

Can anyone assist in providing some guidance to solve the difficult problem of reading data from Oracle?


Thanks.

tdidomenico
12-04-2008, 12:12 PM
Here are the steps to follow:

1) place ojdbc14.jar in a known location. I'm assuming "c:\ojdbc14.jar" for this example.

2) Extract "DatabaseUtils.props.oracle" from the "weka/experiment/" directory inside "weka.jar" (which is just a zip file, in case you're not familiar with it).

3) Copy "DatabaseUtils.props.oracle" as "DatabaseUtils.props" to the weka installation directory (the same directory where you can find weka.jar).

4) Modify "DatabaseUtils.props" to fit your needs. I'm attaching an example. You'll see that there's a mapping for VARCHAR2 as well as CHAR. You can add more if weka complains about not being able to handle a specific type.

5) Start weka with the following command: "javaw -Xmx512m -classpath .;weka.jar;c:\ojdbc14.jar weka.gui.Main". (This must be run from the weka install directory, otherwise fix the path to weka.jar and the root weka install dir as needed. Also remember to enter the correct path to the jdbc driver).

6) When you start weka, you should see your DB URL in the "URL" box of the "Open DB..." dialog. Simply input your user info with the "User" button, and you should be able to connect and query.

Hope this helps. Let me know if it's not clear enough and we can work on it ;)

Cheers!

dougneedham
12-04-2008, 01:28 PM
Thank you.

This got me through the issues I was having.

I can now pull data directly from the original table in oracle.


Nice concise instructions.

Pulling pieces of instructions from multiple places was making things difficult.

Thanks again.

Doug

tdidomenico
12-04-2008, 01:59 PM
Glad it helped. Cheers!

jojobuabin
01-04-2009, 08:21 PM
Hi,

I followed the instructions given by tdidomenico but I ended up with the exception below.

What am I doing wrong? Any help??

"exception: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@172.16.5.163:1521:masteritem"

my driver is "jdbcDriver=oracle.jdbc.driver.OracleDriver" and I am using Oracsle 10g Enterprise Edition (Not Express)

Thank you

Heba
02-03-2013, 03:57 PM
please can you explain more how to link oracle db with weka??

PrezAdam
03-12-2016, 03:32 PM
please can you explain more how to use the sizegenetics extender (https://pewarriors.com/my-sizegenetics-review-and-results) link oracle db with weka??

Yeah, I was wondering how to do this too, I still don't get it as I get the "exception: java.sql.SQLException" error every time.

Mark
03-13-2016, 02:57 PM
This exception indicates that the driver class is not getting found, so you're classpath is not set correctly. If you are using Weka 3.7, then there is a package (installable via the package manager) called JDBCDriversDummyPackage. Install this package and you will get a place to put JDBC driver jar files, which will then be placed into the classpath for Weka automatically. Once this package is installed just copy/move your Oracle JDBC driver jar into $HOME/wekafiles/packages/JDBCDriversDummyPackage/lib. Then restart Weka.

Cheers,
Mark.