The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Smalltalk Daily 04/29/10: Statement Caching and Oracle

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/29/10: Statement Caching and Oracle Posted: Apr 29, 2010 4:47 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/29/10: Statement Caching and Oracle
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 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.


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/29/10: Statement Caching and Oracle

Topic: Automated Workspace Management Previous Topic   Next Topic Topic: DSL Book now available as rough-cut

Sponsored Links



Google
  Web Artima.com   

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