Wednesday, 5 February 2014

How to connect a MYSQL database with Weka ?

How  to connect  a MYSQL database with Weka ?


This tutorial explains making a connection between MySql database with weka.

PRE-REQUISITE:
  1. MYSQL already installed  windows OS system at port Number: 3306
  2. Download the mysql-connector-java-5.0.8-bin.jar 
  3.  Windows operating system(OS)
Follow these steps to download and install weka - mysql database connection on your Windows machine.

Step 1:
             
          
Find  jdbc jar file:  in my case  jar path is ==>C:\Users\Reddy\Java-JDBC\JavaJdbctest\mysql-connector-java-5.1.36-bin.jar
 (Download from following link: https://dev.mysql.com/downloads/connector/j/5.0.html)

Step 2:
           
Copy mysql-connector-java-5.1.36-bin.jar file to =>  C:\Program Files\Weka-3-6

           Now go to your weka installed folder and try to locate RunWeka.ini file , and modify 'RunWeka.ini" file with notepad/wordpad  editor.

"RunWeka.ini" by default  located at => C:\Program Files\Weka-3-7\RunWeka.ini


find and bring following changes to last line where  cp=%CLASSPATH%; 

Replace with following cp=%CLASSPATH%;C:\Program Files\Weka-3-6\mysql-connector-java-5.1.36-bin.jar





                                                                   Figure : 1.1
Setting Class path 



Save changes to RunWeka.ini file

Now go Weka GUI Chooser > Tools > SqlViewer(ctrl+s) 

Figure :1.2
Replace default URL with jdbc:mysql://localhost:3306/test (Figure: 1.3)


Figure : 1.3
Enter your username : root(by default ) and Password that you already set to mysql user (Figure:1.4)

Figure:1.4


Now click on connect button 



Key words : weka mysql database connection, weka, database , weka-3-6.3.7 

6 comments: