Hi Amita
I finally found some time to spend on this issue, and had a
question in mind. When using datasource, what's the difference from
the username and password that can be defined on the datasource
itself, and the one a user set on the connection property inside the
das config ?
In order to test this, here is what I did :
- created a secured derby database (requires username/password)
- configureda datasource in TC, specifying the username, password
<Resource name="jdbc/dastest"
type="javax.sql.DataSource"
auth="Container"
description="Derby database for DAS Samples"
maxActive="100" maxIdle="30"
maxWait="10000" username="dastest" password="dastest"
driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:D:/Opensource-Servers/apache-tomcat-5.5.20/Databases/dastest;create=true"/>
- use a das config pointing to a datasource, without specifying
connectionProperties.
And this worked fine for me, using a slightly modified company-webapp
sample. I also remember trying very similar datasource with MySQL and
having no problems...
In witch case we would need to use the username/password from the das
config, instead of the one configured with the datasource ?
On Oct 30, 2007 12:40 AM, Amita Vadhavkar <[EMAIL PROTECTED]> wrote:
> 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
>
--
Luciano Resende
Apache Tuscany Committer
http://people.apache.org/~lresende
http://lresende.blogspot.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]