ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bing Qiao <qiaob...@gmail.com>
Subject To get the URL out of DataSource
Date Thu, 07 Jul 2005 13:42:52 GMT
Dear all,

I need to get the URL string to show which environment (dev, test or
production)  the application is running in.

Here is what I did.
import org.apache.commons.dbcp.BasicDataSource;
 String environment = "";
 DataSource ds = sqlmap.getDataSource();

 if (ds instanceof BasicDataSource) {
   StringTokenizer cnnString = new StringTokenizer( ( (BasicDataSource) (ds)).
       getUrl(), ":");


It works. But I'm not sure if it is the right way. Is the Datasource
object returned from sqlmap really a BasicDataSource object?

Thanks very much for your attention!


View raw message