These is a document object, Actually inserting the document into databale file. //text = dbBlob.getSubString(1,((intdbBlob.length())); it will write the object not string you understand?
-----Original Message----- From: Tom K [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 08, 2004 11:13 AM To: 'Tomcat Users List' Subject: RE: Problem in inserting word document into database as a blob object under tomcat server I see you are using an Oracle database. String text; while(re.next(){ dbBlob = (oracle.sql.BLOB)rs.getBlob(1) } text = dbBlob.getSubString(1,((intdbBlob.length())); Why not use a CLOB if it's text. Now you are my wife. Tom K. -----Original Message----- From: Thangamani, Elanjchezhiyan (Cognizant) [mailto:[EMAIL PROTECTED] Sent: Monday, June 07, 2004 11:11 PM To: [EMAIL PROTECTED] Subject: Problem in inserting word document into database as a blob object under tomcat server > Hi, > I am inserting word document into database as a blob. It is inserting successfully but we try to download it is not downloading. The insertion itself having some problem > > //code listed below > > StringBuffer query = new StringBuffer("Insert into PMS_Documents(DOCUMENTID, DOCUMENT_NAME, DOCUMENT_TYPE_ID, DOCUMENT_DESCRIPTION, DOCUMENT_CTYPE,CREATED_BY, CREATED_DATE,DOCUMENT_BLOB) values("); > pmskey =getSequence("Document.nextval"); > query.append(pmskey); > query.append(",'"); > query.append(form.getDocumentName()); > query.append("',"); > query.append(Integer.parseInt(getLookUPId("document", form.getDocumentType()))); > query.append(",'"); > query.append(form.getDocumentDescription().trim()); > query.append("','"); > query.append(form.getDocumentBlob().getContentType()); > query.append("','"); > query.append(form.getDocumentCreatedBy()); > query.append("',sysdate,EMPTY_BLOB())"); > query.toString(); > ................................. > conn = getConnection(); > conn.setAutoCommit(false); > stat = conn.createStatement(); > stat.execute(query); > stat.execute("commit"); > String SQL_GET_BY_PK ="select document_blob from PMS_Documents where documentId="+ pmskey +" for update nowait" ; > rs = stat.executeQuery(SQL_GET_BY_PK); > rs.next(); > ResourceBundle resBun = ResourceBundle.getBundle("pms"); > String server = resBun.getString("server"); > if (server.equals("tomcat")) { > dbBlob = (oracle.sql.BLOB)rs.getBlob(1); //problem occurs here only > } > else { > weblogic.jdbc.rmi.SerialOracleBlob cast1 = (weblogic.jdbc.rmi.SerialOracleBlob)rs.getBlob(1); > weblogic.jdbc.rmi.internal.OracleTBlobImpl cast2 = (weblogic.jdbc.rmi.internal.OracleTBlobImpl)cast1.getTheRealBlob(); > dbBlob = (oracle.sql.BLOB)cast2.getTheRealBlob(); > } > inStream = new BufferedInputStream(form.getDocumentBlob().getInputStream()); > //createDocument(inStream); > outStream = dbBlob.getBinaryOutputStream(); > while((len = inStream.read()) != -1) { > outStream.write(len); > fileSize += len; > } > if(inStream != null) { > inStream.close(); > inStream = null; > } > if(outStream != null) { > outStream.close(); > outStream = null; > } > > I am getting problem in tomcat only . weblogic it is working fine. > > Thanks in Advance > Elan > This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.682 / Virus Database: 444 - Release Date: 5/11/2004 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Visit us at http://www.cognizant.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]