You were correct. Thanks - i modified my code to make it work.
The following is the piece of code
Code:
public class DAOImpl {
static {
// Loads the context
String location = "<>/dataSourceConfig.xml";
context = new FileSystemXmlApplicationContext(location);
}
public DAOImpl getInstance() throws Exception {
return (DAOImpl) context.getBean("springJDBC");
}
public DTO getFiles(DTO dto) {
String methodName = "getFiles ";
try {
// TODO Auto-generated method stub
DAOImpl dao = getInstance();
JdbcTemplate template = new JdbcTemplate(dao.getDataSource());
int count = template.queryForInt("select count(*) from obt_manreq");
} catch (DataAccessException daEx) {
daEx.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
Now, i would like to know if this is indeed a proper way of using JDBC in Spring.