package gov.va.med.ars.spring.dao;

import java.io.FileNotFoundException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


import org.springframework.jdbc.core.JdbcTemplate;

public class BaseDao 
{
	protected JdbcTemplate jdbcTemplate;
	//protected ResultsCache resultsCache;

//	public void setDataSource( DataSource dataSource)
//	{
//		this.jdbcTemplate=new JdbcTemplate(dataSource);
//	}
//	
//	public DataSource getDataSource()
//	{
//		return jdbcTemplate.getDataSource();
//	}
	
	public JdbcTemplate getJdbcTemplate() {
		return jdbcTemplate;
	}

	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

/*	public ResultsCache getResultsCache() {
		return resultsCache;
	}

	public void setResultsCache(ResultsCache resultsCache) {
		this.resultsCache = resultsCache;
	}*/
	
	public ResultSet getResultSet(Connection conn, String Query)throws SQLException
	{
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery(Query);
		return rs;

	}

	/**This method returns a connection
	 * @param String Driver
	 * @param String URL
	 * @param String pwd
	 * @return Connection conn
	 * @exception ClassNotFoundException
	 * @exception SQLException
	*/

	public Connection getConnection(String driver, String url, String login, String pwd)throws ClassNotFoundException, SQLException
	{
		Class.forName(driver);
		Connection conn = DriverManager.getConnection(url, login, pwd);
		return conn;
	}//getConnection
	/**This method returns a FileInputStream
	 * @param String FileName
	 * @return FileInputStream fis
	 * @exception FileNotFoundException
	*/
	

	
}
