• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

accesing database???

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know that database is accessed using <data-source> in struts-config.
but what are all the properties we need to specify?
data-source>
<set-property property="autoCommit" value="false"/>
<set-property property="key" value=""/>
<set-property property="description" value=""/>
<set-property property="driverClass" value=""/>
<set-property property="maxCount" value="8"/>
<set-property property="minCount" value="2"/>
<set-property property="url" value=""/>
<set-property property="user" value=""/>
<set-property property="password" value=""/>
</data-source>
What are maxCount,minCount,url,key ???
And i found that findDataSource() method is deprecated so what do i use in action class/ or databaseconnection class?
Can any body take time and explain me how to open connection using DataSource?

Thanks inadvance.
Sri
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.informit.com/articles/article.asp?p=23734
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
KEY-----The servlet context attribute under which this data source will be stored. The attribute is optional and the default value is org.apache.struts.Globals#DATA_SOURCE_KEY.
autoCommit-- value="true" after INSTER ROW,UPDATE ROW,DELETE ROW it will commit the operartion after execution of statement.
url = database server address like jdbc:mysql-caucho://localhost:3306/datasource
minCount & maxCount may be no of rows to featch.
Look up data sources directly in servlet context attributes insted of findDataSource() method.
InitialContext ic = new InitialContext();
DataSource ds =(DataSource) ic.lookup(dataSourceName);
Connection conn = ds.getConnection();
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic