The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalk Daily 04/21/10: Using LOB data with Oracle and ObjectStudio

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Smalltalk Daily 04/21/10: Using LOB data with Oracle and ObjectStudio Posted: Apr 21, 2010 6:01 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Smalltalk Daily 04/21/10: Using LOB data with Oracle and ObjectStudio
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

Today's Smalltalk Daily looks at using LOB data in Oracle with ObjectStudio. If you're looking for a particular topic, you can find it with the Media Search application on our site.

Here's the script used in the screencast; or skip to the video:


"LOB buffer size example."

"When dealing with LOBs, setting the right size of buffers used to 
transfer data between the server and client is important.  For 
example, if  the LOBs are large, allocating a big buffer will 
reduce the network round trips when inserting or fetching 
LOB values."

"The following are examples to demonstrate performance 
improvement when setting the right size of LOB buffers."

"Logon to the Oracle Server."
ret := ObjectStudio.OracleDatabase 
	logOnServer: #OracleDB 
	user: #useid 
	password: #pwd 
	alias: #OracleDB.

"Get the Oracle database instance."
db := ObjectStudio.Database accessName: #OracleDB.

"Drop the test table if existed."
db execSql: 'DROP TABLE TestLob'.

"Create the test table."
res := db execSql: 'CREATE TABLE TestLob (a CLOB, b BLOB, c INT)'.

"Input 2MB CLOB and BLOB."
ClobLength := 2097152. 
BlobLength := 2097152. 
ClobInput := String new: ClobLength withAll: $a.
BlobInput := ByteArray new: ClobLength withAll: 1.

db beginTran.
"Insert the test data."
insertSQL := 'INSERT INTO TestLob (a, b, c) VALUES ( ?, ?, ?)'.

db lobBufferSize: 32768.  "32KB is the default buffer size for read/write Large Objects."

insertTime1 := [
   res := db execSql: insertSQL vars: (Array with: ClobInput  with: BlobInput with: 1).
] millisecondsToRun.

"Print out the miliseconds spent."
('Insert time when lobBufferSize is 32768: ' + insertTime1) out.	

"Set lobBufferSize to 1MB"
db lobBufferSize: 1048576.

insertTime2 := [
   res := db execSql: insertSQL vars: (Array with: ClobInput  with: BlobInput with: 2).
] millisecondsToRun.

"Print out the miliseconds spent."
('Insert time when lobBufferSize is 1048576: ' + insertTime2) out.	

db commit.

db beginTran.

selectSQL := 'select * from TestLob'.

db lobBufferSize: 32768.  "32KB is the default buffer size for read/write Large Objects."

selectTime1 := [
        db execSql: selectSQL answerLobAsProxy: false.

] millisecondsToRun.

"Print out the miliseconds spent."
('Select time when lobBufferSizeis 32768: ' + selectTime1) out.	


"Set lobBufferSize to 1MB"
db lobBufferSize: 1048576.

selectTime2 := [
        db execSql: selectSQL answerLobAsProxy: false.

] millisecondsToRun.

"Print out the miliseconds spent."
('Select time when lobBufferSizeis 1048576: ' + selectTime2) out.	

db rollback.



To watch, click on the viewer below:

If you have trouble viewing that directly, you can click here to download the video directly

You can also watch it on YouTube:

Technorati Tags: , , , ,

Read: Smalltalk Daily 04/21/10: Using LOB data with Oracle and ObjectStudio

Topic: Disappointed, Australia my home Previous Topic   Next Topic Topic: Agile Conferences: Look To No Epiphany

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use