Insert BLOB (Byte Array data) in VAST 5

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Insert BLOB (Byte Array data) in VAST 5

sam-2

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/qAPYEv_mjaUJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

jtuchel
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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/6VYkq9BmxcoJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

jtuchel
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

Am Montag, 14. Mai 2012 11:21:58 UTC+2 schrieb [hidden email]:
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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/_HEREsMue_sJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

Douglas Swartz
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

Tuesday, May 15, 2012, 3:58:53 AM, you wrote:

> 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

> Am Montag, 14. Mai 2012 11:21:58 UTC+2 schrieb [hidden email]:
> 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


> Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:
> 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

> Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:
> 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




--
Best regards,
 Douglas                            mailto:[hidden email]

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

sam-2
In reply to this post by jtuchel
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.



On Tuesday, May 15, 2012 3:58:53 AM UTC-5, [hidden email] wrote:
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

Am Montag, 14. Mai 2012 11:21:58 UTC+2 schrieb [hidden email]:
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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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


Am Freitag, 11. Mai 2012 13:50:05 UTC+2 schrieb Sam:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/zuOzKkEUgxEJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

sam-2
In reply to this post by sam-2

On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/rWyEc--wKTMJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

sam-2
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


On Tuesday, June 5, 2012 1:07:06 PM UTC-5, Sam wrote:

On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/Tisr23YsLScJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

jtuchel
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

Am Dienstag, 5. Juni 2012 20:08:44 UTC+2 schrieb Sam:
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


On Tuesday, June 5, 2012 1:07:06 PM UTC-5, Sam wrote:

On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/P8v_n4ETUuwJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Insert BLOB (Byte Array data) in VAST 5

jtuchel
Sorry, try DateAndTime now...

Am Dienstag, 5. Juni 2012 20:49:17 UTC+2 schrieb [hidden email]:
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

Am Dienstag, 5. Juni 2012 20:08:44 UTC+2 schrieb Sam:
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


On Tuesday, June 5, 2012 1:07:06 PM UTC-5, Sam wrote:

On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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


On Friday, May 11, 2012 6:50:05 AM UTC-5, Sam wrote:

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

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/6O1DK67FbX8J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en.