User guide
Example
•
•
Set the sqlcache property of the Properties passed to the
DriverManager.getConnection method:
Properties info = new Properties();
info.put("user", user);
info.put("password", pw);
info.put("sqlcache", 100);
conn = DriverManager.getConnection (connStr, info);
Append
@sqlcache
to the database specification part of the connect URL:
Connection conn = DriverManager.getConnection(
jdbc:rdbthin://bravo:1701/my_db_dir:personnel@sqlcache=100,user,
pass);
In addition a SET SQLCACHE statement can be executed.
Stmt.executeUpdate(set sqlcache 100);
The value specified with the sqlcache switch tells the thin driver how many SQL statements
it can hold concurrently in its cache. A value of 0 (the default) specifies that SQL statement
caching be disabled.
Once the SQL statement cache is full for a given connection, the storing of a new statement
will remove the least commonly used statement from the cache.
Because SQL statements may be held in cache even after the user has closed the containing
java.sql.Statement, the query will still be registered as current by Oracle Rdb and may
prevent actions such as DROP TABLE from being done. In addition each concurrent
statement that is held in cache may take up memory on both the server and client side of the
connection.
You can clean out the connection SQL cache by issuing a SET SQLCACHE statement with
value 0 and then issuing another SET SQLCACHE statement to reset the cache to the desired
size.
Currently you cannot specify the removal of a specific SQL statement from cache.
Note:
SQL statement caching is a client-side action and is disabled by default. This feature is only
applicable to the thin driver. Using the SQL Statement cache property or using the set
sqlcache statement will be silently ignored by the native driver.
Contents
135