Hey guys,
I'm trying my hand at outputting into a MySQL table but I'm running into
a "Communications link failure" during the reduce (in the
getRecordReader() method of DBOutputFormat to be more specific). Google
tells me this seems to happen when a SQL server drops the client
(usually after a period of time) but I'm wondering why that would be the
case here. I also threw in a cookie cutter connection at the beginning
of my driver and that seems to be connecting fine:
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/wiki",
"user", "pass");
System.out.println ("Database connection established");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
Here's the main snippet:
conf.setOutputKeyClass(TermFrequencyWritable.class); // My
DBWritable
conf.setOutputValueClass(NullWritable.class);
conf.setMapOutputKeyClass(Text.class);
conf.setMapOutputValueClass(TermFrequencyWritable.class);
conf.setOutputFormat(DBOutputFormat.class);
DBConfiguration.configureDB(conf, "com.mysql.jdbc.Driver",
"jdbc:mysql://localhost/wiki", "user", "pass");
DBOutputFormat.setOutput(conf, "table", "word", "docid",
"frequency");
Has anyone encountered this before or know where this is going wrong?
Thanks,
- Bill