You can cast it to SQLServerDataSource since DataSource is just an interface. In other words, all instantiated objects have a concrete class. The object is either a SQLServerDataSource or some other concrete object, regardless of the pointer class.
Keep in mind, you should check for class-safe compatibility by using the instanceof operator.
Why are you implementing your own data source, TestdataSource? You rarely make your own data source, other than as a wrapper.
As you have defined it TestdataSource is not an instance of SQLServerdatasource.
Joined: Oct 27, 2009
Thanks for the response scott.
This is to implement the proxy design pattern which is my cleint requirement.
I've to proceed like this only for the SQLServerDataSource.
OK, if i do testdatasource extends SQLserverDataSource i can achieve want i want.(setting the applicationname).
But i'm having problem in accessing the datasource as specified earlier.
Which is the retrieval of sqlserverdatasource from appserver's datasource.
i changed the type of datasource to sqlserverdatasource and factory to sqlserverdatasourceobjectfactory from BasicDataSourceFactory.
But still having runtime problems which says "javax.naming.NamingException: Invalid DataSource reference"
2. if i can't get SQLServerDataSource from appaserver then, can we do this?
The datasource i'm getting with out any changes to type & factory values to sqlserver is basicdatasource.
Which is instance of basicdatasource.(org.apache.tomcat.dbcp.dbcp.BasicDataSource -- which extendsObject implements Datasource) .
If above is not possible then, can we change basicDataSource to SQLServerDataSource.
If so how can i do that?
Thanks for th
How can we do this?
Any suggestion or help required.