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