Code example for Statement

Methods: executeQuery, setQueryTimeout

0
				st = con.createStatement();
				String line = 
						"SELECT * FROM dishRating WHERE user="  + 
								"'" + user + "' and date='" + date + "' and dish= '"+dishName+"';";
				System.out.println(line);
				st.setQueryTimeout(5);
				ResultSet rs = st.executeQuery(line);
				System.out.println("server check");
				/*String result = ""; 
				while(rs.next()) { 
	            	result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n"; 
	            } 
	            System.out.println("****"+result+"*****");*/ 
				if(rs.isBeforeFirst()){
					return true; 
				}else{ 
					return false; 
				} 
			} catch (SQLException e) {
				// TODO Auto-generated catch block 
				System.out.println("no connection!!!"+"check");