Hi,
If you just want to make fun of me, please do go elsewhere.
Bruno
well I just want to express that did i done something amazing ..........but
You got so angry for that I m sorry...
well I want to share my experience working with the blob object and the
bytes array
I found that if the size of a file is less then the size of that blob object
buffer then it will not store any data
I am trying to find out why this is happen and if any body knows then please
share his/her knowledge with me cause I want to know why it happens that if
the byte array size is less then the blob size then y it not store any data
in database.
well I also share my experience of storing pages sepratly I didn't tried it
yet and share it soon
Thanx for the help
Waq
I execute this code. its fine for now.
public void strorePage(Connection conn, long
sequanceNo,ByteArrayOutputStream pdfOutputStream) throws SQLException,
IOException {
boolean success = false;
BLOB dbObject = null;
Statement stmt = conn.createStatement();
conn.setAutoCommit(false);
String sql = "INSERT INTO TablePage(PAGEID, PAGEDATA) VALUES (" +
sequanceNo + ",empty_blob())";
stmt.execute(sql);
sql = "SELECT PAGEDATA FROM TablePage WHERE PAGEID = " + sequanceNo;
ResultSet rs = stmt.executeQuery(sql);
if (rs.next()) {
dbObject = ((OracleResultSet) rs).getBLOB("PAGEDATA");
}
if (dbObject != null) {
try {
byte[] bytes = pdfOutputStream.toByteArray();
OutputStream outStream = dbObject.getBinaryOutputStream();
int fileSize = dbObject.getBufferSize();
outStream.write(bytes, 0, bytes.length);
// here i m trying to fill the empty space in the byte
array if the file size is less then the size of the blob
byte[] empty = new byte[fileSize - bytes.length];
java.util.Arrays.fill(empty, (byte)0);
outStream.write(empty);
outStream.close();
pdfOutputStream.close();
} catch (IOException ex) {
}
}
Waq
From: bruno <[EMAIL PROTECTED]>
To: Waq lala <[EMAIL PROTECTED]>
CC: [email protected]
Subject: Re: [iText-questions] Storing document page by page in DB
Date: Mon, 15 May 2006 16:12:18 +0200
Waq lala wrote:
hahaha
I am not amused.
yes i execute it and as i told u that i m able to store this Blob Object.
I must have missed that. Your mail was hard to understand.
now i m still there where i was.......
I have no idea where that is.
I want to store the document object in database as i explain prevoisly plz
help me out from this
You say you can store the document in the database.
I quote: " told u that i m able to store this Blob Object".
If by "i explain prevoisly" you mean you want to store
separate pages, then I can only repeat what I have said before.
"Use the class com.lowagie.tools.plugins.Burst as inspiration
to split the file in the ByteArrayOutputStream into separate pages.
Write each page to another ByteArrayOutputStream. Save the
byte[] obtained from the ByteArrayOutputStream to your database
as a BLOB."
If you mean something else, then I have no idea what you are
talking about.
If you just want to make fun of me, please do go elsewhere.
br,
Bruno
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions