You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by "Streckfus, William [USA]" <st...@bah.com> on 2009/04/14 22:45:00 UTC

DBOutputFormat - Communications link failure

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

RE: DBOutputFormat - Communications link failure

Posted by "Streckfus, William [USA]" <st...@bah.com>.
Responding to this for archiving purposes...

After being stuck for a couple hours I then realized that localhost meant a
different machine as it ran on different reducers :). Thus, replacing that
with the IP address did the trick.

-----Original Message-----
From: Streckfus, William [USA] [mailto:streckfus_william@bah.com] 
Sent: Tuesday, April 14, 2009 4:45 PM
To: core-user@hadoop.apache.org
Subject: DBOutputFormat - Communications link failure

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