MiG InfoCom MiG Calendar DBConnect Guide User Manual
Page 20
![background image](https://www.manualsdir.com/files/798677/content/doc020.png)
MiG InfoCom AB
pollIntervall is > 0 poll actions will be added, though
coalesced (removed) if next to each other in the queue.
Adapting to Other Databases (DBTypeAdapter)
For instance the JDBC driver for the Oracle database returns a
BigDecimal
object for
Integer
and
Long
columns. Other
untested databases or JDBC drivers may have similar oddities and
the
DBTypeAdapter
are created to accommodate for these cases.
DBTypeAdapter
is a converter that converts objects returned from
the JDBC driver into more appropriate Java object types that can be
handled by DBConnect. You install the converter on a
DBDataProvider
instance.
View the
DBTypeAdapter
JavaDoc for details on how to use this
class.
Listening for Concurrent Update Events
Since DBConnect is using the high performance optimistic locking
algorithm there are the possibility that if data are updated from two
clients at the same time one of the updates will be lost. Optimistic
locking will identify that the data will be lost though and you can listen
for these occasions by adding a
ConcurrentUpdateListener
to the
DataProvider
. The listener can with customizable logic
decide what to do in these cases. Re-read the data or force an update
to the database anyway, even though the data in the database has
been changed since it was last read.
View the
DataProvider.addConcurrentUpdateListener
JavaDoc for details on how to do this.
Listening for Exceptions
Since DBConnect is using a background thread to communicate with
the database it is not possible to surround the actions that will lead to
a database interaction with a try-catch block. You can get the same
result by adding an
ExceptionListener
to the
DataSynchronizer
. It will be notified if a database action resulted
in an exception, including a reference to the original exception.
If no listeners are registered with the data synchronizer the exception
will be dumped to
System.err
.
View the
DataSynchronizer.addExceptionListener
JavaDoc for details on how to do this.
Note that if a
DataAction
(for instance a poll or save) is retired
more than
retryCount
number of times it will be put back first in
DBConnect Guide
Page 20 / 25