smalltalk
April 30, 2010 6:49:39.586
Today's Smalltalk Daily looks at reusing column buffers with Oracle (version 9 and up) with VisualWorks. This is an upcoming feature of VisualWorks, scheduled for VW 7.7.1. If you're looking for a particular topic, you can find it with the Media Search application on our site.
The code used is below; To watch, click on the viewer :
"Connect to an Oracle database."
conn := OracleConnection new.
conn username: 'username';
password: 'password';
environment: 'ORACLEDB'.
conn connect.
sess := conn getSession.
"The default is false meaning not to reuse."
sess reuseColumnBuffers: false.
t1 := Time millisecondsToRun:[
" | conn sess ansStrm |"
100 timesRepeat: [
sess prepare: 'select * from sys.all_tables where TABLE_NAME=''DUAL'''.
sess execute.
ansStrm := sess answer.
res := ansStrm upToEnd.
].
].
Transcript cr; show: 'Time spent without reusing row buffers: ', t1 asFloat printString.
"Set to reuse the column buffers."
sess reuseColumnBuffers: true.
t2 := Time millisecondsToRun:[
" | conn sess ansStrm |"
100 timesRepeat: [
sess prepare: 'select * from sys.all_tables where TABLE_NAME=''DUAL'''.
sess execute.
ansStrm := sess answer.
res := ansStrm upToEnd.
].
].
Transcript cr; show: 'Time spent with reusing row buffers: ', t2 asFloat printString.
You can download the video directly here . If you like this kind of video, why not subscribe to "Smalltalk Daily "?
Technorati Tags:
video , visualworks , database , oracle , reuse buffers
posted by James Robertson
smalltalk
April 29, 2010 21:40:01.000
You might have noticed that I used the VisualWorks workspace in a few recent ObjectStudio screencasts; now Andreas has addressed the issue that drove me to that :
What are Workspace Variables? Well, a Workspace Variables is just like any other variable, except that it is defined in the context of the current Workspace. This way you can get always the content of the variable, if you use the same Workspace. That's what's cool about Smalltalk - want a feature? You can add it, whether you're an expert like Andreas or not.
Technorati Tags:
objectstudio , workspace
posted by James Robertson
smalltalk
April 29, 2010 18:38:01.000
Spotted in self halt
For example, to access the Google Spreadsheets APIs and Tools, you need to download the Java client libraries and all its dependencies. The paths to there Jars must be known to the JVM and can be set through JNIPort. For easy deployment, I put together a single jar using an Ant build script
That's pretty cool - there are tons of Java libraries that connect to tons of things and JNIPort opens up that world to Smalltalk. It's all about reuse :)
Technorati Tags:
java , JNIPort
posted by James Robertson
smalltalk
April 29, 2010 15:58:14.000
posted by James Robertson
smalltalk
April 29, 2010 13:56:16.000
posted by James Robertson
smalltalk
April 29, 2010 11:52:30.000
posted by James Robertson
smalltalk
April 29, 2010 9:50:23.000
posted by James Robertson
smalltalk
April 29, 2010 6:49:34.601
Today's Smalltalk Daily looks at using Statement Caching against Oracle (version 9 and up) with VisualWorks. If you're looking for a particular topic, you can find it with the Media Search application on our site.
The code used is below; To watch, click on the viewer :
"The following are two examples, one uses statement caching, the other does not."
conn := OracleConnection new.
"Verify whether the loaded OCI supports Statement Caching."
conn supportStatementCaching.
"Set to use statement caching."
conn useStatementCaching: true.
conn environment: 'ORACLEDB';
username: 'username';
connect: 'password'.
"Get Statement Cache Size, the default is 20."
conn getStatementCacheSize.
"Set Statement Cache to desired size."
conn setStatementCacheSize: 30.
"Verify the new Statement Cache Size."
conn getStatementCacheSize.
t1 := Time millisecondsToRun:[
" | conn sess ansStrm |"
100 timesRepeat: [
sess prepare: 'select * from sys.all_tables where TABLE_NAME=''DUAL'''.
sess execute.
ansStrm := sess answer.
res := ansStrm upToEnd.
].
].
Transcript
cr;
show: 'Time spent when using Statement Caching: ', t1 asFloat printString.
conn := OracleConnection new.
"Set to use statement caching."
conn useStatementCaching: false.
conn environment: 'ORACLEDB';
username: 'username';
connect: 'password'.
t2 := Time millisecondsToRun:[
" | conn sess ansStrm |"
100 timesRepeat: [
sess prepare: 'select * from sys.all_tables where TABLE_NAME=''DUAL'''.
sess execute.
ansStrm := sess answer.
res := ansStrm upToEnd.
].
].
Transcript
cr;
show: 'Time spent without using Statement Caching: ', t2 asFloat printString.
You can download the video directly here . If you like this kind of video, why not subscribe to "Smalltalk Daily "?
Technorati Tags:
oracle , database , statement , caching , visualworks
posted by James Robertson
smalltalk
April 28, 2010 13:07:05.000
posted by James Robertson
smalltalk
April 28, 2010 6:51:07.133
Today's Smalltalk Daily looks at using Oracle's pre-fetch capability with VisualWorks. If you're looking for a particular topic, you can find it with the Media Search application on our site.
The code used is below; To watch, click on the viewer :
"Connect to an Oracle database."
conn := OracleConnection new.
conn username: 'username';
password: 'password';
environment: 'ORACLEDB'.
conn connect.
sess := conn getSession.
"Drop the test table if existed."
sess prepare: 'DROP TABLE TESTTABLE';
execute;
answer;
answer.
"Create a test table."
sess prepare: 'CREATE TABLE TESTTABLE(
NUMMER int ,
BEMERKUNG varchar2 (30)
)';
execute;
answer;
answer.
"Set the number of recrods being inserted."
loopCount := 1000.
"The SQL used to do insert."
sql := 'INSERT INTO TESTTABLE VALUES (?, ?)'.
"Insert: Using array binding."
insertTime2 := Time millisecondsToRun: [
|bindArray numArray stringArray |
numArray := Array new: loopCount.
stringArray := Array new: loopCount.
1 to: loopCount do: [ :i|
numArray at: i put: i.
stringArray at: i put: 'test'.
].
bindArray := Array with: numArray with: stringArray.
sess prepare: sql.
sess bindInput: bindArray;
execute;
answer;
answer.
].
"Print out the miliseconds spent."
Transcript
cr;
show: 'Time spent using array binding: ', insertTime2 asFloat printString.
"Set times to repeat."
loopCount := 1.
"Set the SQL to do the fetch."
sql := 'SELECT * from TESTTABLE'.
"Default value of prefetch rows is 1."
sess setPrefetchRows: 1.
selectTime1 := Time millisecondsToRun: [
1 to: loopCount do: [ :i|
sess prepare: sql;
execute.
ans := sess answer.
res := ans upToEnd.
].
].
"Print out the miliseconds spent."
Transcript
cr;
show: 'Time spent when prefetch rows is 1: ', selectTime1 asFloat printString.
"Set prefetch rows to 100."
sess setPrefetchRows: 100.
selectTime2 := Time millisecondsToRun: [
1 to: loopCount do: [ :i|
sess prepare: sql;
execute.
ans := sess answer.
res := ans upToEnd.
].
].
"Print out the miliseconds spent."
Transcript
cr;
show: 'Time spent when prefetch rows is 100: ', selectTime2 asFloat printString.
"Set prefetch rows to 500."
sess setPrefetchRows: 500.
selectTime3 := Time millisecondsToRun: [
1 to: loopCount do: [ :i|
sess prepare: sql;
execute.
ans := sess answer.
res := ans upToEnd.
].
].
"Print out the miliseconds spent."
Transcript
cr;
show: 'Time spent when prefetch rows is 500: ', selectTime3 asFloat printString.
You can download the video directly here . If you like this kind of video, why not subscribe to "Smalltalk Daily "?
Technorati Tags:
visualworks , database , oracle , prefetch
posted by James Robertson