• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

DataSource passing param

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have concerns over passing DataSource object in a method. Rather, can the client (ClassA) create a datasource object and pass it to other method (in a classB)?

Thanks in advance,

Example:

public classA {

public static List getData() {
return new ClassB().getData(createDataSource());
}

private static DataSource c{
//Create a datasource object (ds) based on the
//database connection parameters
return ds
}

} //classA

public classB {
public List getData(DataSource ds) {
//Establishes connection gets the
//resutset and processes it and
//returns a List of data
}
} //classB
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic