For 1):
do you have the full nested stacktrace? Did you deactivate the ping
query? and are you sure the exception originates in iBATIS (we'll see
from the full stacktrace). The intention of a cache is to speed things
up, it's not the intention to have a complete in-core database.
For 2)
There's no way for iBATIS to be automatically aware of updates by other
applications. This is a problem for every database application, not just
iBATIS. If you would develop an application without iBATIS (with your
own developed caching), how would you know in your application whether
another application updated your database?
Regards,
Sven
James Johnson wrote:
I have a few questions regarding iBatis cacheModel. All help is greatly
appreciated.
1) When the iBatis cacheModel is used, a connection to the database server appears to be still required. The data has been cached, so I'm not sure why the database server needs to be up after caching the data.
For exapmle, I have test code that basically returns the same row of data n times. As expected, the data is cached and remains unchanged desipte making updates using the database command line client (i.e. outside of my program). During the ith (1<i<=n) try, I shutdown the database server. I would expect iBatis to just use the cache results and not require the database server to be up. However, instead I get the following error when I bring the database server down:
Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused: connect
I would like to have mechanism that allows the application to use cached data
in the event the database server is down as it does when the database server is
up. Is the cachModel capable of providing this functionality? Why does the
database server need to be up when iBatis is using cached results?
2) By specifying the flushOnExecute, iBatis will flush the cache when a certian
statement(s) is executed. Is there a way for iBatis to flush the cache when
anything (i.e. another application) makes an update, insert or delete?