Search code examples
javamysqlmahout

Setting up Apache Mahout to use MySql


I am a .NET developer by trade, but I am working on a REST service implementation of Mahout for our website. I am having trouble setting up Mysql as the DataSource for MySQLJDBCDataModel. This is essentially how I am trying to go about it (Yes it is copy and pasted from Mahout In Action.)

MysqlDataSource dataSource = new MysqlDataSource ();
dataSource.setServerName("my_database_host");
dataSource.setUser("my_user");
dataSource.setPassword("my_password");
dataSource.setDatabaseName("my_database_name");
JDBCDataModel dataModel = new MySQLJDBCDataModel(
dataSource, "my_prefs_table", "my_user_column",
"my_item_column", "my_pref_value_column");

The problem is that Java is not recognizing "MysqlDataSource" as a valid object and won't compile. When I try to include "com.mysql.*" it says it can't resolve that either.

Any help would be great


Solution

  • Is your MySQL driver in the java classpath? See if this link here helps.

    Next time, please post details of your setup, like which server hosts your app.