![]()
![]() ![]() ![]() ![]() ![]() ![]() ![]() Documentation Top ![]() Global Index ![]() Reference Manual ![]() ![]() ![]() Developer's Guide ![]() ![]() Tuning Cloudscape ![]() ![]() |
Working with Multiple Connections to a Single Database
|
Embedded | Server | |
---|---|---|
Multi-Threaded From an application, using a single Connection to a Cloudscape database and issuing requests against that connection in multiple threads. | Supply a single Connection object to separate threads. Cloudscape ensures that only one operation is applied at a time for consistency. Note that committing a transaction commits all statements open against a single connection. For more information, see Transactions. | Server frameworks such as Cloudconnector and RmiJdbc can automatically multi-thread operations. Allowing Cloudconnector to multi-thread does not affect transaction control, which is handled by the source application. Remote client applications can multi-thread if desired. |
Multi-Connection From an application, using multiple connections to a Cloudscape database and issuing requests against those connections on multiple threads. (You must have a multi-user license to have more than one connection to Cloudscape.) | Create individual connections within a single application and use the appropriate connection for each JDBC request. The connections can all be to the same database, or can be to different databases in the same Cloudscape system. | Cloudconnector and RmiJdbc always manage multiple connections. Remote client applications can establish the multiple connections desired. |
Multi-User Multiple applications accessing the same Cloudscape database. Each user application has its own connection or connections to the database. | Not possible. Only one application can access a database at a time, and only one application can access a specific system at a time. In the current release, Cloudscape may not prevent multiple applications from concurrently accessing the same Cloudscape system, but do not allow this because such access can corrupt the databases involved. | Only one server should access a database at a time. Multiple remote client applications can access the same server, and thus can access the same database at the same time through that server. |
Multi-user database access is possible if Cloudscape is running inside a server framework.
If more than one client application tries to modify the same data, the application that gets the table first gets the lock on the data (either specific rows or the entire table). The second application has to wait until the first application commits or rolls back the transaction in order to access the data. If two applications are only querying and not modifying data, they can both access the same data at the same time because they can each get a shared lock. For more information, see Locking, Concurrency, and Isolation.
A single application can work with multiple Connections to the same database and assign them to different threads. The application programmer can avoid concurrency and deadlock problems in several ways: