posted 18 years ago
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