For example if you were to use postgres default DataSource you would need to identify the inidividual properties as well as the actual driver class which comes with the Struts Distro so struts-config.xml would identify the Generic Data Source via
<!-- configuration for GenericDataSource wrapper -->
<data-source>
  <set-property
    property="autoCommit"
    value="false"/>
  <set-property
    property="description"
    value="Example Data Source Configuration"/>
  <set-property
    property="driverClass"
    value="org.postgresql.Driver"/>
  <set-property
    property="maxCount"
    value="4"/>
  <set-property
    property="minCount"
    value="2"/>
  <set-property
    property="password"
    value="mypassword"/>
  <set-property
    property="url"
    value="jdbc:postgresql://localhost/mydatabase"/>
  <set-property
    property="user"
    value="myusername"/>
</data-source>
courtesy of Linux Struts How to located at
http://linux.com.hk/docs/struts/faqs/database.html
Martin-
001-617-852-7822
----- Original Message ----- From: "Thibaut L." <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Friday, May 27, 2005 8:25 AM
Subject: Re: DataBase connection


thank you for answering so fast.
i knew there were this object but i don't find how to use it.
i've tried : DataSource aDataSource = (DataSource) dataSources.entrySet().iterator().next();
but it doesn't work.

Martin Gainty a écrit :

should be identified as DataSources within your ActionServlet take a look at
http://struts.apache.org/api/org/apache/struts/action/ActionServlet.html#dataSources
HTH,
Martin-

----- Original Message ----- From: "Thibaut L." <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Friday, May 27, 2005 7:49 AM
Subject: DataBase connection


hi, i'd like to access mysql from the my own controller init method.
I usually do :

|dataSource = getDataSource(request);
myConnection = dataSource.getConnection();

but i have no request object in my init method.
Any idea ?

thanks.
|




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to