public static void readValue(){
        try{
            Class.forName("org.gjt.mm.mysql.Driver").newInstance();
            Connection con = DriverManager.getConnection("jdbc:mysql://localhost/mysql?user=root");
            Statement stmt = con.createStatement();
            ResultSet rs = stmt.executeQuery("Select * from test");
            if (rs.next()){
                Blob b = rs.getBlob(2); //the blob column index
                InputStream is = b.getBinaryStream();
                long l = b.length();
                byte[] x = new byte[1024];
                int lengthRead = 0;    // Number of bytes read
String fileToWriteBlob = "C:test.txt"; //你自己相应的文件名
FileOutputStream outputStream = new FileOutputStream( fileToWriteBlob);
while ((lengthRead = is.read(x)) != -1){
outputStream.write(x, 0, lengthRead);
}
is.close();
outputStream.close();
            }
            rs.close();
            stmt.close();
            con.close();
        } catch (Exception ex){
            ex.printStackTrace();
        }    }