db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David W. Van Couvering" <David.Vancouver...@Sun.COM>
Subject Re: How does an application get access to JDBC implementation classes
Date Sat, 19 Nov 2005 01:21:16 GMT
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:


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.



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

View raw message