Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Application server statement caching

206475Jun 11 2004 — edited Jun 14 2004
I am very disappointed with this product.
This is my first project that use Oracle Application server. I recently joined this project, after it gone to production.
We are facing big performance problems on the database. Database is issuing HUGE amount of soft parses. Most of calls to database are made from stateless session beans. This looked pretty easy to fix. I knew that both JBoss and Weblogic use statement caching internally, so I supposed that was the case with Oracle AS too.
I've spent more than two days trying to figure out how to use it. Particulary misleading was the JDBC guide , where is described how to use statement caching WITH THE DRIVER. I tried to get the connection from the datasource, then to cast it to OracleConnection and use setStmtCacheSize.
Example:
(from data-sources.xml)
<data-source class="oracle.jdbc.pool.OracleDataSource"
connection-driver="oracle.jdbc.driver.OracleDriver"
ejb-location="jdbc/ESCIS2DS"
inactivity-timeout="30"
location="jdbc/ESCIS2CoreDS"
name="jdev-connection:ESCIS2"
password="blah"
pooled-location="jdbc/ESCIS2PooledDS"
url="jdbc:oracle:thin:@zmax.ceetel.net:1523:escis"
username="blah"
xa-location="jdbc/xa/ESCIS2XADS"
max-connections="1000" >
</data-source>

Now, if you try:

InitialContext ctx=new InitialContext();
DataSource ds = (DataSource) ctx.lookup ("jdbc/ESCIS2CoreDS");
con=ds.getConnection();
System.out.println(con.getClass().getName());

You will get what you want:
oracle.jdbc.driver.OracleConnection
But...this is ordinary connection, not from the pool, and if you use statement caching on it, it will last only until the bean is destroyed.

On the other hand, with jdbc/ESCIS2PooledDS:
com.evermind.sql.DriverManagerConnectionPoolConnection,
and you cannot cast it to OracleConnection, it is a wrapper from application server. This class is completely undocumented, you cannot find anything about it.

The situation became clear after I have read "Oracle 9iAS Best Practices in Performance and Scalability:Application Design and Configuration". If you carefuly read the Appendix B (example for statement caching), you will find that:
a) They used SERVLET for example
b) They used OracleConnectionCacheImpl , an OCI extension to driver, and not the connection
pool from the server!

Moral of the story:
If you call the database from EJB you will inevitably make a soft parse.
Or use Jboss or Weblogic.

Dusan Miloradovic
Oracle/J2EE developer

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 12 2004
Added on Jun 11 2004
3 comments
394 views