Hi, 1.) What is the difference between javax.sql.DataSource and javax.sql.ConnectionPoolDataSource. 2). I want to use the connection Pool, which one of the DataSource i'll choose. 3) What is the use of DataSource.getConnection(String user, String pwd) if i give ds.getConnection("test","test123"); where user id and pwd are Database related. It throws SQLException as getConnection(user,password) not implemented. I am using oracel thin driver. Regards, M.S.Raman.
The latter of the two does support connection pooling, whereas the first doesn't. This practically means that the ConnectionPoolDataSource can provide you with a PooledConnection. The answer to your second question now is obvious, I think.
3) What is the use of DataSource.getConnection(String user, String pwd)
Looks like a method for connection to different users after you have defined your database parameters with the DataSource.
if i give ds.getConnection("test","test123"); where user id and pwd are Database related. It throws SQLException as getConnection(user,password) not implemented.
There is no obligation on an implementor of the JDBC interfaces to actually implement all methods defined in the interface. At the moment I don't have the Oracle docuemntation at hand, so I wouldn't know whether they have (not) implemented the method you tried to use. I piece of unasked-for advize: you 'd probably do yourself a favour reading about the JDBC Standard Extensions (Sun has a specification and a tutorial covering this) and the Oracle Thin Driver (a very extensive manual has been published by Oracle). Good riding! Rudy.
Joined: Nov 07, 2001
Thanks for your information. But still I have a doubt about the dataSource, Because in JDBC tutorial in Sun Site and Weblogic docs for connection pool they are mentioned the javax.sql.DataSource only. Regards, M.S.Raman
Joined: Jul 27, 2002
Hi there Malli, That 's strange, at least at first glance. I went to a Sun page on JDBC, and indeed in their example they do use a simple DataSource object. On second thought this is not so strange, after all a ConnectionPoolDataSource inherits from a DataSource. Therefore we can call the ConnectionPoolDataSource as a DataSource. Apparently this is what the people at Sun want to show: the incredible flexibility of Java through the use in inheritance. :roll: Be that as it may (and of course this is a big advantage at coding time) they also add a warning to this page:
Deployment of a DataSource object that supports connection pooling involves the deployment of a ConnectionPoolDataSource object that is used by a connection pooling module in the middle tier of a three-tier architecture.
This is also quite clear, I would think. I would like to write something to get rid of an obvious miscoimmunication, but I wouldn't know what Perhaps you can post the exact nature of your problem with these quotes, in order to get me to answer to it. Good riding, Rudy.
Joined: Nov 07, 2001
Thanks for replying me once again. Let I'll explain my query clearly: Since you mentioned that ConnectionPoolDataSource is related with the ConnectionPool. To get a connection from the connection Pool Object I expect the following Code
That is in JNDI lookup we will search for ConnectionPoolDataSource for the ConnectionPoolDataSource Object for the ConnectionPool and get the pooledConneciton Object then we can get the connection OBject. But in Sun Doc or any other app server doc they are using the following Code:
Connection con = ds.getConnection("myUserName", "myPassword"); To get a connection Object from the connection Pool we are using DataSource Object and not Connection Pool DataSource. 2. I want to know how the Driver Class implements the Connection Pool Mechanism. Is it Driver Classes are internally using the Connection Pool DataSource Object. 3. In many documents it has mentioned that ConnectionPoolDataSource is used to get the Connection Object for the Connection POOL. But in nowhere they are using the ConnectionPoolDataSource. Regards, M.S.Raman