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?

You can directly create an instance of a given DataSource in leiu of using DriverManager. There are a required number of setters and any additional properties must all be available via a setter.


Thanks,

David

Reply via email to