Discussion:
Finding the size of a BLOB
Paul-Benoit Larochelle
2006-09-05 00:29:24 UTC
Permalink
Hello all,

I have an application which must display hugue reports in a JTabbedPane
Reports are presented with JTable in the scrollPane of a JPanel
The fastest way I found after many trials is to generate the JTables in
a thread when the application is started, to create the JPanel and to
store the JPanel as a Java object in a table.
When the user want to see a report, the application retreives the JPanel
and add it to the JTabbedPane.

This works fine... McKoi is great !!!

Now, some reports are hugue: 12,000 rows, 20 columns. So I would like
to present a ProgressBar, in a thread, while the application is
retreiving the JPanel from the database.... I guess that after some
tests ans trials I could guess how long it takes to retreive a JPanel of
xxxMB from the database but for that I need the size of the serialized
JPanel... how can I achieve that ?

The easiest way would be to store in the table row the size of the
JPanel serialized object:

Create Table Reports (Obj JAVA_OBJECT, Id INTEGER, BlobSize INTEGER);

PreparedStatement insert = connection.prepareStatement("Insert Into
Reports (Obj, Id, BlobSize) Values(?, ?, ?)");

void sqlInsert(JPanel panel, int id) {
try {
insert.setObject(1, panel);
insert.setInt(2, id);
insert.setInt(3, .......... what is the Blob
size ??????????????);
}
}

then when I will retreive the JPanel I would first fetch the BlobSize
("Select BlobSize from Reports where Id = ?" from the row and start a
thread to display the ProgressBar according to the size of the JPanel

I guess that this is trivial for some of the SQL gurus around

Thanks
Paul-Benoit
s***@ebd-integration.de
2006-09-05 00:30:04 UTC
Permalink
Sehr geehrte Damen und Herren,

in der Zeit vom 26.08. bis 12.09.2006 bin ich im Urlaub. In
dringenden Fällen wenden Sie sich bitte an unser Support-Team unter der
Nummer: 08158 - 90563 - 50 oder per E-mail an:
***@ebd-integration.de

Mit freundlichen Grüßen
Steffen Brehme




---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
Paul-Benoit Larochelle
2006-09-06 03:51:21 UTC
Permalink
I have found a way....
I serialize myself the JPanel by writting it to a ByteArrayOutputStream
Then I can get the ByteArrayOutputStream byte[] .length
I put the byte[] in the BD
Read back the byte[] from the BD
Read back the JPanel with a ByteArrayInputStream(byte[])

-----Original Message-----
From: Paul-Benoit Larochelle [mailto:***@sympatico.ca]
Sent: Monday, September 04, 2006 20:29
To: '***@mckoi.com'
Subject: Finding the size of a BLOB

Hello all,

I have an application which must display hugue reports in a JTabbedPane
Reports are presented with JTable in the scrollPane of a JPanel
The fastest way I found after many trials is to generate the JTables in
a thread when the application is started, to create the JPanel and to
store the JPanel as a Java object in a table.
When the user want to see a report, the application retreives the JPanel
and add it to the JTabbedPane.

This works fine... McKoi is great !!!

Now, some reports are hugue: 12,000 rows, 20 columns. So I would like
to present a ProgressBar, in a thread, while the application is
retreiving the JPanel from the database.... I guess that after some
tests ans trials I could guess how long it takes to retreive a JPanel of
xxxMB from the database but for that I need the size of the serialized
JPanel... how can I achieve that ?

The easiest way would be to store in the table row the size of the
JPanel serialized object:

Create Table Reports (Obj JAVA_OBJECT, Id INTEGER, BlobSize INTEGER);

PreparedStatement insert = connection.prepareStatement("Insert Into
Reports (Obj, Id, BlobSize) Values(?, ?, ?)");

void sqlInsert(JPanel panel, int id) {
try {
insert.setObject(1, panel);
insert.setInt(2, id);
insert.setInt(3, .......... what is the Blob
size ??????????????);
}
}

then when I will retreive the JPanel I would first fetch the BlobSize
("Select BlobSize from Reports where Id = ?" from the row and start a
thread to display the ProgressBar according to the size of the JPanel

I guess that this is trivial for some of the SQL gurus around

Thanks
Paul-Benoit
s***@ebd-integration.de
2006-09-06 03:52:06 UTC
Permalink
Sehr geehrte Damen und Herren,

in der Zeit vom 26.08. bis 12.09.2006 bin ich im Urlaub. In
dringenden Fällen wenden Sie sich bitte an unser Support-Team unter der
Nummer: 08158 - 90563 - 50 oder per E-mail an:
***@ebd-integration.de

Mit freundlichen Grüßen
Steffen Brehme




---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
j***@souwest.co.za
2006-09-06 04:08:48 UTC
Permalink
I am out of the office until Wednesday 13 September 2006.




---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com

Loading...