OK, I think I may have the answer to my question. Looking at the JDBC
API, here is what I can figure out. There are the following Connection
factories that a JDBC implementation must provide:
Driver
DataSource
XADataSource
ConnectionPoolDataSource
Next question:
How do the instances of these get created? It looks like the data
sources are generally registered with JNDI using getObjectInstance().
But do we allow users to create new instances directly (e.g. "new
ClientDataSource()")? I noticed the constructor was public...
It looks like Driver creates a new instance of itself when the class is
loaded. Do I have that right? But again, we don't support someone
saying "new ClientDriver()" directly, right? Again, I noticed that this
is currently a public method.
Thanks,
David
David W. Van Couvering wrote:
Hi, all. I would like to know exactly what are the approved/documented
ways to get a connection.
My reason for asking this is, I want to understand what all touch points
there are in JDBC that allow you to get access to the first
implementation class for a given driver. If I have it right, everything
hangs off of a Connection, so what are the ways in which you get a
Connection?
I know one way is to load the driver class and then use
DriverManager.getConnection().
Another way is, in a managed environment, use JNDI or some other
mechanism to load a registered DataSource and then use that to get a
connection.
Are there other ways? Can, for instance, a user directly create an
driver specific DataSource instance (rather than going through JNDI) and
then use that to create connections? Or is that not a supported mechanism?
Thanks,
David
begin:vcard
fn:David W Van Couvering
n:Van Couvering;David W
org:Sun Microsystems, Inc.;Database Technology Group
email;internet:[EMAIL PROTECTED]
title:Senior Staff Software Engineer
tel;work:510-550-6819
tel;cell:510-684-7281
x-mozilla-html:TRUE
version:2.1
end:vcard