You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by vaibhavi <sh...@elitecore.com> on 2002/12/04 12:46:05 UTC
how to access property of the Data Source Configuration
Hi,
I have congifured my struts-config.xml for databse as follows
<!-- ========== Data Source Configuration
=============================== -->
<!--
<data-sources>
<data-source>
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="Example Data Source Configuration"/>
<set-property property="driverClass"
value="org.gjt.mm.mysql.Driver"/>
<set-property property="maxCount"
value="4"/>
<set-property property="minCount"
value="2"/>
<set-property property="password"
value="ecatalog"/>
<set-property property="url"
value="jdbc:mysql://192.9.203.211:3306/ecatalog"/>
<set-property property="user"
value="ecatalog"/>
</data-source>
</data-sources>
-->
Now how do I access this properties in to my servlet file.
import org.apache.commons.sql.util.*;
try
{
dataSource = getDataSource(request);
Conn = dataSource.getConnection();
String selquery="Select * from aaa";
pstmt = conn.prepareStatement(selquery);
rs = pstmt.executeQuery();
while(rs.next())
{
System.out.println("This is
:"+rs.getString("id"));
}
}catch (SQLException sqle)
{
getServlet().log("Connection.process", sqle);
}
Is it right way.
Because
import org.apache.commons.sql.util.*;
gives me error since I don't have common*.jar for sql how can I manage
this.
Regards,
Vaibhavi Shah
_____