java - Weka connection to MySQL in Eclipse -


i'm trying use weka library write own software throws jdbc driver exception.

my code (mostly copy-pasted tutorial):

package test;  import weka.core.instances; import weka.experiment.instancequery;  public class test {      public static void main(string[] args) throws exception{          instancequery query = new instancequery();          query.setusername("root");         query.setpassword("");         query.setquery("select id_activite activites limit 1");          instances data = query.retrieveinstances();         system.out.println(data.tostring());      }  } 

i exception:

trying add database driver (jdbc): rmijdbc.rjdriver - error, not in classpath? trying add database driver (jdbc): jdbc.idbdriver - error, not in classpath? trying add database driver (jdbc): com.mckoi.jdbcdriver - error, not in classpath? trying add database driver (jdbc): org.hsqldb.jdbcdriver - error, not in classpath? exception in thread "main" java.sql.sqlexception: no suitable driver found jdbc:idb=experiments.prp     @ java.sql.drivermanager.getconnection(unknown source)     @ java.sql.drivermanager.getconnection(unknown source)     @ weka.experiment.databaseutils.connecttodatabase(databaseutils.java:523)     @ weka.experiment.instancequery.retrieveinstances(instancequery.java:286)     @ weka.experiment.instancequery.retrieveinstances(instancequery.java:271)     @ seniorhome.test.main(test.java:17) 

i have added both weka.jar , weka-src.jar files separately through build path - add external jars , i've added mysql-connector-java-5.1.34-bin.jar file through same method.

if write test class connect database works (so it's not issue server):

public class test {     public static void main(string[] args) {         connection conn = null;         statement stmt = null;         resultset rs = null;         try { //          new com.mysql.jdbc.driver();             class.forname("com.mysql.jdbc.driver").newinstance(); // conn = drivermanager.getconnection("jdbc:mysql://localhost:3306/testdatabase?user=testuser&password=testpassword");             string connectionurl = "jdbc:mysql://localhost:3306/b3l";             string connectionuser = "root";             string connectionpassword = "";             conn = drivermanager.getconnection(connectionurl, connectionuser, connectionpassword);             stmt = conn.createstatement();             rs = stmt.executequery("select id_activite activites");             while (rs.next()) {                 string id = rs.getstring("id_activite");                 system.out.println("id: " + id);             }         } catch (exception e) {             e.printstacktrace();         } {             try { if (rs != null) rs.close(); } catch (sqlexception e) { e.printstacktrace(); }             try { if (stmt != null) stmt.close(); } catch (sqlexception e) { e.printstacktrace(); }             try { if (conn != null) conn.close(); } catch (sqlexception e) { e.printstacktrace(); }         }     } } 

between switching files, adding them build path etc, had accidentally added file without modifying database parameter in databaseutils.prop file.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -