Whats a connection “context”?
Discussion of connection contexts can get a little deep, but you can think of a connection context as a framework for a set of connections for SQL operations that use a particular set of database resources. This mechanism allows you to implement more robust semantics-checking during translation. In SQLJ, each database connection uses its own instance of a connection context class. Each connection of a particular connection context uses an instance of a single connection context class. SQLJ provides one connection context class–sqlj.runtime.ref.DefaultContext–and you can declare additional connection context classes as needed. Each connection context uses its own class, so has its own “type”. Such “strong typing” is one of the key advantages of SQLJ, allowing for rigorous semantics-checking during translation. The fact is, however, that many (even most) applications need only one connection context and so can get by using only the DefaultContext class without declaring any additional