Code example for Statement

Methods: close, executeQuery

0
			 String myDriver = "com.mysql.jdbc.Driver";
		      String myUrl = "jdbc:mysql://localhost/optionsDb";
		      Class.forName(myDriver);
		      Connection conn = DriverManager.getConnection(myUrl, "root", "einstein123");
		              Statement st=conn.createStatement();
			           ResultSet rs=st.executeQuery("select * from loginTb where user='"+user+"' and pass='"+pass+"'");
			           int count=0;
			           while(rs.next()){
			           count++;
			           break; 
			          } 
			           rs.close();
			           st.close();
			           conn.close();
			          if(count>0){
			           return true; 
			           } 
			  } 
			    catch(Exception e){
			    System.out.println(e);
			}