Thursday, December 13, 2007

Serializable connection?

JDBC DataSource is the evolution of classic JDBC DriverManager. It is an entity that doles out database connections.
1) automatically pool and reuse database connection
2) DataSource objects can be stored in JNDI tree. i.e., it is serializable. How can we serialize a connection? The secret is that it does RMI-based proxy for JDBC connections. The actual connections are in the server JVM, but RMI connection (stub object) is sent to external clients, which do their JDBC calls, which ferry to the connection and ferry back results.
*** The RMI stub object is network aware reference to remote object and it is serializable.

No comments: