que tipo de arquivo eh Elias? aquele exempo que postei eu conseguia ler jpeg, qual o erro que acontece?
Elias, Escreveu em Tuesday, March 15, 2005, 8:25:58 AM: ES> Galera conseguir gravar no banco de dados, mas o exemplo de como lê o ES> arquivo não deu certo, alguem tem um exemplo de como recuperar arquivos em ES> campo blob? ES> ----- Original Message ----- ES> From: "CMilfont" <[EMAIL PROTECTED]> ES> To: "Elias Sales" <discussao@cejug.org> ES> Sent: Monday, March 14, 2005 4:46 PM ES> Subject: Re[2]: [cejug-discussao] Tratamento de dados em blob >> eh do grupo apache, acho que vem no tomcat 5, se nao entra no projeto >> jakarta e procura la que vc acha.... >> >> Elias, >> Escreveu em Monday, March 14, 2005, 3:54:11 PM: >> >> ES> <%@ page import="org.apache.commons.fileupload.*" %> >> >> ES> Qual api tem esse pacote? >> >> >> ES> ----- Original Message ----- >> ES> From: "David Barbosa Feitosa" <[EMAIL PROTECTED]> >> ES> To: <discussao@cejug.org> >> ES> Sent: Monday, March 14, 2005 3:44 PM >> ES> Subject: Re: [cejug-discussao] Tratamento de dados em blob >> >> >> >> O Netbeans debuga >> >> eh só colocar os break points no JSP >> >> e acompanhar na Aba de debug. >> >> flws! >> >> >> >> ldaniel wrote: >> >> >> >> >Oi, pessoal. >> >> > >> >> >Só um comentário: >> >> > >> >> >A menos que você conheça uma forma eficiente de debugar o JSP, não é ES> uma >> >> >prática muito boa colocar tanto código Java, pois fica muito mais ES> difícil >> >> >encontrar problemas. Quanto ao debug do JSP, estou procurando um jeito >> ES> (sei >> >> >que tem gente que faz), mas não conheço ainda. Então, se alguém souber ES> e >> >> >quiser compartilhar, eu ficaria grato. >> >> > >> >> >[]s. >> >> > >> >> >----- Original Message ----- >> >> >From: "Elias Sales" <[EMAIL PROTECTED]> >> >> >To: <discussao@cejug.org>; "CMilfont" <[EMAIL PROTECTED]> >> >> >Sent: Wednesday, March 02, 2005 18:59 >> >> >Subject: Re: [cejug-discussao] Tratamento de dados em blob >> >> > >> >> > >> >> > >> >> > >> >> >>Valeu cara vou testar... >> >> >> >> >> >>----- Original Message ----- >> >> >>From: "CMilfont" <[EMAIL PROTECTED]> >> >> >>To: "Elias Sales" <discussao@cejug.org> >> >> >>Sent: Wednesday, March 02, 2005 10:04 AM >> >> >>Subject: Re: [cejug-discussao] Tratamento de dados em blob >> >> >> >> >> >> >> >> >> >> >> >> >> >> >>>ve se esses codigos te ajudam... >> >> >>> >> >> >>>jsp com um exemplo de insercao: >> >> >>> >> >> >>><%@ page import="java.util.*" %> >> >> >>><%@ page import="java.text.*" %> >> >> >>><%@ page import="java.sql.*" %> >> >> >>><%@ page import="org.apache.commons.fileupload.*" %> >> >> >>> >> >> >>><% >> >> >>>if (FileUpload.isMultipartContent(request)) { >> >> >>> DiskFileUpload fu = new DiskFileUpload(); >> >> >>> fu.setSizeMax(800000); >> >> >>> try { >> >> >>> List items = fu.parseRequest(request); >> >> >>> Iterator i = items.iterator(); >> >> >>> FileItem fi; >> >> >>> String cmt=null; >> >> >>> >> >> >>> while (i.hasNext()) { >> >> >>> fi = (FileItem)i.next(); >> >> >>> if (fi.isFormField()) { >> >> >>> cmt = fi.getString(); >> >> >>> } else{ >> >> >>> >> >> >>> int size = (int) ES> fi.getSize(); >> >> >>> byte [] imagem = new >> ES> byte[size]; >> >> >>> imagem = fi.get(); >> >> >>> >> >> >>> //upload.read(imagem, 0, ES> size); >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>Class.forName("com.mysql.jdbc.Driver"); >> >> >> >> >> >> >> >> >>> Connection con = >> >> >>> >> >> >>> >> >> >> >>>DriverManager.getConnection("jdbc:mysql://localhost:3306/sistema?user=root ES> & >> ES> p >> >> > >> >> > >> >> >>assword="); >> >> >> >> >> >> >> >> >>> PreparedStatement pstm = >> >> >>> >> >> >>> >> >> >>con.prepareStatement("INSERT INTO tb_fotos (nome, foto) VALUES (?, ES> ?)"); >> >> >> >> >> >> >> >> >>> pstm.setString(1, cmt); >> >> >>> pstm.setBytes(2, imagem); >> >> >>> pstm.executeUpdate(); >> >> >>> con.close(); >> >> >>> } >> >> >>> } >> >> >>> } catch (FileUploadException e) { >> >> >>> out.print("Erro no upload do arquivo"); >> >> >>> } catch (SQLException e) { >> >> >>> out.print("Erro na consulta com o banco de >> >> >>> >> >> >>> >> >> >>dados"); >> >> >> >> >> >> >> >> >>> } catch (Exception e) { >> >> >>> out.print(e.getMessage()); >> >> >>> } >> >> >>>}else { >> >> >>> out.print("O Formulario nao possui dados binários"); >> >> >>>} >> >> >>> >> >> >>>%> >> >> >>> >> >> >>><html> >> >> >>><body bgcolor="#FFFFFF"> >> >> >>><h2>Fonto inserida com sucesso no banco de dados!</h2> >> >> >>></body> >> >> >>></html> >> >> >>> >> >> >>>/************************************ >> >> >>>exemplo de leitura: >> >> >>> >> >> >>><%@ page language="java" %> >> >> >>><%@ page import="java.util.*" %> >> >> >>><%@ page import="java.text.*" %> >> >> >>><%@ page import="java.io.*" %> >> >> >>><%@ page import="java.lang.*" %> >> >> >>><%@ page import="java.sql.*" %> >> >> >>><%@ page import="java.awt.*" %> >> >> >>> >> >> >>><%! >> >> >>>byte [] image; >> >> >>>%> >> >> >>> >> >> >>><% >> >> >>>try { >> >> >>> // criando a conexao com o banco de dados >> >> >>> >> >> >>> Class.forName("com.mysql.jdbc.Driver"); >> >> >>> Connection con = >> >> >>> >> >> >>> >> >> >> >>>DriverManager.getConnection("jdbc:mysql://localhost:3306/sistema?user=root ES> & >> ES> p >> >> > >> >> > >> >> >>assword="); >> >> >> >> >> >> >> >> >>> //PreparedStatement pstm = >> >> con.prepareStatement("INSERT INTO >> >> >>> >> >> >>> >> >> >>tb_fotos (nome, foto) VALUES (?, ?)"); >> >> >> >> >> >> >> >> >>> Statement stm = con.createStatement(); >> >> >>> >> >> >>> int codigo; >> >> >>> // pegando o codigo da foto a ser exibida >> >> >>> if (request.getParameter("numero") == null){codigo = 1; } >> >> >>> else{codigo = >> ES> Integer.parseInt(request.getParameter("numero"));} >> >> >>> >> >> >>> ResultSet rs = stm.executeQuery("SELECT * FROM tb_fotos ES> WHERE >> ES> id >> >> >>> >> >> >>> >> >> >= >> >> > >> >> > >> >> >>"+codigo); >> >> >> >> >> >> >> >> >>> if (rs.next()) { >> >> >>> >> >> >>> Blob blob = rs.getBlob("foto"); >> >> >>> >> >> >>> >> >> //JPEGManager.encodeJPG(response.getOutputStream(), >> >> >>> >> >> >>> >> >> >>blob.getBytes(1, (int) blob.length())); >> >> >> >> >> >> >> >> >>> image = blob.getBytes(1, (int) blob.length()); >> >> >>> int BUFFER = image.length; >> >> >>> InputStream fs = new ByteArrayInputStream(image); >> >> >>> JPEGImageDecoder decoder = >> >> >>> >> >> >>> >> >> >>JPEGCodec.createJPEGDecoder(fs); >> >> >> >> >> >> >> >> >>> BufferedImage bImage = >> >> decoder.decodeAsBufferedImage(); >> >> >>> JPEGImageEncoder encoder = >> >> >>> >> >> >>> >> >> >>JPEGCodec.createJPEGEncoder(out); >> >> >> >> >> >> >> >> >>> encoder.encode(bImage); >> >> >>> fs.close(); >> >> >>> fs = null; >> >> >>> encoder = null; >> >> >>> bImage = null; >> >> >>> >> >> >>> } >> >> >>> con.close(); >> >> >>>}catch (Exception e){ >> >> >>> // erro >> >> >>> %>Erro encontrado<% >> >> >>>} >> >> >>>%> >> >> >>> >> >> >>> >> >> >>>Elias, >> >> >>>Escreveu em Tuesday, March 1, 2005, 7:03:19 PM: >> >> >>> >> >> >>>ES> alguem tem algum exemplo de gravar e ler campos em >> >> >>>ES> blob usando mysql? >> >> >>>-- >> >> >>>Atenciosamente, >> >> >>> CMilfont >> >> >>> [EMAIL PROTECTED] >> >> >>> >> >> >>>-- >> >> >>>Curtindo: Pitty Festival de Verão 2005 - 01 >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >>> >> >> >> >>>>------------------------------------------------------------------------- ES> - >> >> >>----------------- >> >> >> >> >> >> >> >> >>>Ceara' Java User Group >> >> >>> >> >> >>> Para cancelar sua assinatura, envie um e-mail para: >> >> >>> >> >> >>> >> >> >>[EMAIL PROTECTED] >> >> >> >> >> >> >> >> >>> Para mais informacoes, mande um e-mail para: ES> [EMAIL PROTECTED] >> >> >>> Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> >> >>> >> >> >>> >> >> >>> >> >> >> >>>>------------------------------------------------------------------------- ES> - >> >> >> >> >> >> >> >> >----------------- >> >> > >> >> > >> >> >>Ceara' Java User Group >> >> >> >> >> >> Para cancelar sua assinatura, envie um e-mail para: >> >> >> >> >> >> >> >> >[EMAIL PROTECTED] >> >> > >> >> > >> >> >> Para mais informacoes, mande um e-mail para: ES> [EMAIL PROTECTED] >> >> >> Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> >> >>>-------------------------------------------------------------------------- ES> - >> ES> ---------------- >> >> > >> >> >Ceara' Java User Group >> >> > >> >> > >> >> > >> >> > Para cancelar sua assinatura, envie um e-mail para: >> ES> [EMAIL PROTECTED] >> >> > >> >> > Para mais informacoes, mande um e-mail para: ES> [EMAIL PROTECTED] >> >> > >> >> > Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > >> >> >> >> >> >> -- >> >> David Barbosa Feitosa >> >> Engenheiro de Sistemas >> >> >> >> Tel.: 55 (81) 3425-5729 >> >> Cel.: 55 (81) 8887-7064 >> >> MSN : [EMAIL PROTECTED] >> >> ICQ : 159135932 >> >> >> >> C.E.S.A.R. - Centro de Estudos e Sistemas Avançados do Recife >> >> >> >> >> >>> ------------------------------------------------------------------------- ES> - >> ES> ----------------- >> >> Ceara' Java User Group >> >> >> >> Para cancelar sua assinatura, envie um e-mail para: >> ES> [EMAIL PROTECTED] >> >> Para mais informacoes, mande um e-mail para: [EMAIL PROTECTED] >> >> Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> >> >> >> >> ES>> ------------------------------------------------------------------------ ES> ------------------- >> ES> Ceara' Java User Group >> >> ES> Para cancelar sua assinatura, envie um e-mail para: >> ES> [EMAIL PROTECTED] >> ES> Para mais informacoes, mande um e-mail para: ES> [EMAIL PROTECTED] >> ES> Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> >> >> >> >> -- >> Atenciosamente, >> CMilfont >> [EMAIL PROTECTED] >> >> -- >> Curtindo: Winamp stopped >> >> >> >> -------------------------------------------------------------------------- ES> ----------------- >> Ceara' Java User Group >> >> Para cancelar sua assinatura, envie um e-mail para: ES> [EMAIL PROTECTED] >> Para mais informacoes, mande um e-mail para: [EMAIL PROTECTED] >> Falar com o administrador? e-mail para: [EMAIL PROTECTED] >> ES> ------------------------------------------------------------------------------------------- ES> Ceara' Java User Group ES> Para cancelar sua assinatura, envie um e-mail para: ES> [EMAIL PROTECTED] ES> Para mais informacoes, mande um e-mail para: [EMAIL PROTECTED] ES> Falar com o administrador? e-mail para: [EMAIL PROTECTED] -- Atenciosamente, CMilfont [EMAIL PROTECTED] -- Curtindo: Winamp stopped ------------------------------------------------------------------------------------------- Ceara' Java User Group Para cancelar sua assinatura, envie um e-mail para: [EMAIL PROTECTED] Para mais informacoes, mande um e-mail para: [EMAIL PROTECTED] Falar com o administrador? e-mail para: [EMAIL PROTECTED]