Insert BLOB (Byte Array data) in VAST 5

105 views
Skip to first unread message

Sam

unread,
May 11, 2012, 7:50:05 AM5/11/12
to va-sma...@googlegroups.com

I am learning Smalltalk. I am trying to insert pdf or image files in oracle BLOB field. Its working fine if the file size is less than 32KB. If its more than 32 KB size its only inserting up to 32 KB of data. I am not sure what I am making mistake over here. I did check the length of data prior to insert I see entire data (around 100KB) When I retrieve data from BLOB I got only 34047 bytes (always),

I did not get any error message though.

I am using VAST 5 and oracle 8i

Here is my routine..

I really appreciated if any one help me to get this works or suggestion.


======
Table definition
“blob_table table has 3 column of( ID number , BODY BLOB, SUBJECT (varchar2).”
” ID NUMBER NOT NULL,
SUBJECT VARCHAR2(256) NULL,
BODY BLOB NULL

====
| logonSpec result fromFile querySpec resultCollection sqlString dict connection lobLocator buffer file aBuffer temp|

conSpec := ( AbtDatabaseConnectionSpec forDbmClass: #AbtOdbcDatabaseManager dataSourceName: ‘dsName’).

logonSpec := ( AbtDatabaseLogonSpec
id: ‘userId’
password: ‘pass’
server: ‘server’ ).
conSpec connectUsingAlias: ‘sampleAlias’
logonSpec: logonSpec.

connection := AbtDbmSystem activeDatabaseConnection.
connection autoCommit: true.
table := (connection openTableNamed: ‘blob_table’).
clobs := AbtOdbcVarBinaryField new.

file := CwFileSelectionPrompter new
searchPath: ‘C:\Temp’;
fileName: ‘*.*’;
prompt.
(file = ‘*.prn’ or: [file = nil])
ifTrue: [^ self].

fileStream := CfsReadFileStream open: file.
fileStream isCfsError
ifTrue: [^System message: 'Unable to open file ' , file , '. ' , fileStream message].
clobs := (fileStream contents) asByteArray.

oc := OrderedCollection new.
newRow := table emptyRow.
newRow
at: #ID put: 131;
at:#SUBJECT put: ‘TEST’;
at: #BODY put: clobs.
oc add: newRow.
table addRows: oc.

fileStream close

jtu...@objektfabrik.de

unread,
May 14, 2012, 5:21:58 AM5/14/12
to va-sma...@googlegroups.com
Sam,

This is not really an answer, I've haven't used Oracle with VAST in quite a while. But...

VAST 5 is at least a decade old. Maybe you should try using a newer version of VAST.

It should be ralatively easy to build a small test application in VAST 8.5 to insert a big BLOB without porting a whole system from VAST 5. A simple insert/select roundtrip should be done in a few hours, including the installation of VAST 8.5

Joachim

jtu...@objektfabrik.de

unread,
May 15, 2012, 4:58:53 AM5/15/12
to va-sma...@googlegroups.com
Sam,

maybe this thread can help you: http://forums.instantiations.com/topic-12-1281.html
or this one, indicating that VAST 7.5 solves the problem: http://forums.instantiations.com/topic-12-1274.html

Just a little more detail on my last comment: but VAST 5.0, according to Wikipedia, was released in 1995. It is 17 years old, so if there is a problem with BLOBs larger than 32 KB, there's probably nobody and nothing that helps other than upgrading to a current version....

Joachim

Douglas Swartz

unread,
May 15, 2012, 7:29:49 AM5/15/12
to va-sma...@googlegroups.com
Sam,

For learning purposes, you can get the latest VA Smalltalk for free from
www.instantiations.com. Just click on the "Free Trial" button on the
home page. Unless Instantiations has changed the license and
distributables lately, you can use the "trial" forever for educational
purposes.

Doug
--
Best regards,
Douglas mailto:swartzco...@gmail.com

Sam

unread,
May 28, 2012, 9:40:06 AM5/28/12
to va-sma...@googlegroups.com
Thanks  Joachim & Doug  for your guides.

It was really helpful, I got implemented this by repeatedly calling oracle stored procedure by passing small junk of data by following the post which you have provided.  It works great. 

Thanks again.

Sam

unread,
Jun 5, 2012, 2:07:06 PM6/5/12
to va-sma...@googlegroups.com

Sam

unread,
Jun 5, 2012, 2:08:44 PM6/5/12
to va-sma...@googlegroups.com
I am stuck again,
 
I am trying to insert date time field in oracle.. I am sure I doing some mistake over here but not sure what I m doing wrong.
 
oc := OrderedCollection new.
newRow := table emptyRow.
newRow
at: #ID put: 131;
at:#SUBJECT put: ‘TEST’;
at: #BODY put: clobs.

at: #LAST_UPDATED_DT put: '2012-02-02 10:20:50 AM'
oc add: newRow.
table addRows: oc.

where last_updated dt is date column, Can some one pleaes help me on this.

Thanks

jtu...@objektfabrik.de

unread,
Jun 5, 2012, 2:49:17 PM6/5/12
to va-sma...@googlegroups.com
HI Sam,

not sure, but I guess VAST does convert between Smalltalk's Time and Oracle's Time columns. 
Maybe you should just try with 

at: #LAST_UPDATED_DT put: Time now.

for a test.

Joachim

jtu...@objektfabrik.de

unread,
Jun 5, 2012, 2:49:42 PM6/5/12
to va-sma...@googlegroups.com
Sorry, try DateAndTime now...
Reply all
Reply to author
Forward
0 new messages