Gostaria de selecionar um arquivo que está no banco de dados em um campo blob e utilizar um JFileChooser para escolher onde salvar o arquivo, alguem sabe como posso fazer isso?
Consegui fazer, caso algueme precise vou postar a solução
[code]private void btnSalvarPdfActionPerformed(java.awt.event.ActionEvent evt) {
try{
int state = jFileChooser2.showSaveDialog(null);
File file = new File(jFileChooser2.getSelectedFile().toString().concat(".pdf"));
if(state == JFileChooser.APPROVE_OPTION){
Connection con = Conexao.obterCon();
PreparedStatement psmt = con.prepareStatement("SELECT documento FROM proposta WHERE cod_prop=? INTO DUMPFILE ?");
psmt.setInt(1, Integer.parseInt(txtCodigo.getText()));
psmt.setString(2, file.getPath());
psmt.executeQuery();
con.close();
JOptionPane.showMessageDialog(null, "Salvo com sucesso");
}
}catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erro ao salvar");
Logger.getLogger(FormCotacao.class.getName()).log(Level.SEVERE, null, e);
}
}
[/code]