package org.maskat.demo.petstore;
import java.sql.*;
import java.util.*;

public class ProductController {

	public Vector findProductController(String productId) {
	
		Vector ret = null;
		Connection con = null;
		ProductDAO dao = null;
		
		try{
			
			Class.forName("org.gjt.mm.mysql.Driver");
			String url = "jdbc:mysql://localhost:3306/jpetshop";
			con = DriverManager.getConnection(url);
			//cm = ConnectionManager.getConnectionManager();
			//con = cm.getConection();
			dao = new ProductDAO(con);
			ret = dao.findProduct(productId);
			
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			try{
				if (con!=null){
					con.close();
				}
			}catch(Exception e){
				e.printStackTrace();
			}
		
		}
		
		return ret;
	}
	
}
	