The requirement was a bit hidden inside below mail thread http://www.mail-archive.com/[email protected]/msg23299.html
Below is the JIRA issue for it. https://issues.apache.org/jira/browse/TUSCANY-1698 checked so far that tomcat BasicDataSource.getConnection() does not support passing in params for username and password. This may be how the current code that uses getConnection(no param) worked so far. But other app servers like WebSphere, or if users of Tomcat opt to use a different connection pool than the one supplied by Tomcat, may need getConnection(userName, password). So to keep things generic, DAS can use userName/password when available in config. In case of exception upon usage or if userName/password not present in Config, DAS can attempt getConnection(no params) - the way it is doing today. We can use the current config as is without any changes like below - <xsd:complexType name="ConnectionInfo"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="ConnectionProperties" type="config:ConnectionProperties"/> </xsd:sequence> <xsd:attribute name="dataSource" type="xsd:string"/> <xsd:attribute name="managedtx" type="xsd:boolean" default="true"/> </xsd:complexType> <xsd:complexType name="ConnectionProperties"> <xsd:attribute name="driverClass" type="xsd:string"/> <xsd:attribute name="databaseURL" type="xsd:string"/> <xsd:attribute name="loginTimeout" type="xsd:int" default="0"/> <xsd:attribute name="userName" type="xsd:string" default=""/> <xsd:attribute name="password" type="xsd:string" default=""/> </xsd:complexType> When ConnectionProperties contain userName, password they will be used to obtain connection (DriverManaged based or DS based). e.g. DataSource - <ConnectionInfo dataSource="java:comp/env/jdbc/ajaxdastest"> <ConnectionProperties userName="dastest" password="dastest" /> </ConnectionInfo> DriverManager - <ConnectionInfo> <ConnectionProperties driverClass="com.mysql.jdbc.Driver" databaseURL="jdbc:mysql://localhost/dastest" userName="dastest" password="dastest" loginTimeout="600000"/> </ConnectionInfo> Suggestions? Regards, Amita
