Demos and Usage of java.sql.PreparedStatement.executeQuery()


   1:         {
   2:             PreparedStatement pstmt=conn.prepareStatement("select userName from UserInfo where userName=? and password=?");
   3:             pstmt.clearParameters();
   4:         ...
   5:             pstmt.setString(2,this.password);
   6:             ResultSet rset=pstmt.executeQuery();
   7:             if(rset.next())
   8:             {
   9:             

View Full Code Here
   1:         {
   2:             PreparedStatement pstmt=conn.prepareStatement("select adminName from adminInfo where adminName=? and password=?");
   3:             pstmt.clearParameters();
   4:         ...
   5:             pstmt.setString(2,this.password);
   6:             ResultSet rset=pstmt.executeQuery();
   7:             if(rset.next())
   8:             {
   9:             

View Full Code Here
   1:       String sql = "SELECT * FROM Personen WHERE nachname LIKE ?";
   2:       PreparedStatement ps = c.prepareStatement(sql);
   3:       ps.setString(1, par);
   4:         ...
   5:       ResultSet r = ps.executeQuery();
   6:       while(r.next())
   7:         System.out.println(r.getString("vorname")+ ", "+ r.getString("nachname"));
   8:     }

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.PreparedStatement;
   3: import java.sql.SQLException;
   4:         ...
   5:    {
   6:       PreparedStatement ps = null;
   7:       
   8:         ...
   9:          ps = connection.prepareStatement("SELECT " + sequenceName + ".nextval FROM dual");
  10:          ResultSet rs = ps.executeQuery();
  11:          

View Full Code Here
   1:     Connection cn = Examples.getConnection();
   2:     PreparedStatement ps =
   3:       cn.prepareStatement("SELECT q.symbol as \"Symbol\", " +
   4:         ...
   5:     ps.setInt( 1, customerId );
   6:     ResultSet rs = ps.executeQuery();
   7:     PrintWriter pw = new PrintWriter(out);
   8:     XMLForResultSet.print(rs,"Quotes","Quote", pw);
   9:     pw.close(); rs.close(); ps.close(); cn.close();

View Full Code Here
   1:     Connection cn = Examples.getConnection();
   2:     PreparedStatement ps =
   3:       cn.prepareStatement("SELECT q.symbol, q.price, q.change" +
   4:         ...
   5:     ps.setInt( 1, id );
   6:     ResultSet rs = ps.executeQuery();
   7:     System.out.println("<?xml version=\"1.0\"?>");
   8:     System.out.println("<Quotes>");
   9:     while (rs.next ()) {

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.PreparedStatement;
   3: import java.sql.ResultSet;
   4:         ...
   5:             Connection connection = this.connector.getConnection();
   6:             PreparedStatement statement = connection.prepareStatement(this.sql);
   7:             statement.setString(1, locale.getLanguage());
   8:         ...
   9:             ResultSet results = statement.executeQuery();
  10:             CodeList codelist = new CodeListImpl();

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.PreparedStatement;
   3: import java.sql.ResultSet;
   4:         ...
   5: 
   6:         PreparedStatement ps = null;
   7:         ResultSet rs = null;
   8:         ...
   9: 
  10:             rs = ps.executeQuery();

View Full Code Here
   1: import java.io.Serializable;
   2: import java.sql.PreparedStatement;
   3: import java.sql.ResultSet;
   4:         ...
   5:         try {
   6:             PreparedStatement st = session.getBatcher().prepareSelectStatement(sql);
   7:             try {
   8:         ...
   9:                 ResultSet rs = st.executeQuery();
  10:                 final String result;

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.PreparedStatement;
   3: import java.sql.ResultSet;
   4:         ...
   5:     Connection conn = null;
   6:     PreparedStatement pstmt = null;
   7:     ResultSet rset = null;
   8:         ...
   9:       pstmt = conn.prepareStatement( "select owner from all_objects" );
  10:       rset = pstmt.executeQuery();
  11:       while( rset.next() )

View Full Code Here
   1:     Connection connection = null;
   2:     PreparedStatement ps = null;
   3:     ResultSet resultSet = null;
   4:         ...
   5:       ps = connection.prepareStatement(sql);
   6:       resultSet = ps.executeQuery();
   7:       if (resultSet.next()) {
   8:         artist = (Artist) resultSet.getObject(2);
   9:         System.out.println("Retrieved artist, name = " + artist.name);

View Full Code Here
   1:       
   2:       PreparedStatement ps = conn.prepareStatement(args[0]);
   3:         ...
   4:       ResultSet rs = ps.executeQuery();
   5:       rs.next();
   6:       
   7:       byte[] bytes = rs.getBytes(1);

View Full Code Here
   1:       
   2:       PreparedStatement ps = conn.prepareStatement("select * from ? where 1=1");
   3:       ps.setString(1, "aff_merchant");
   4:         ...
   5:       ResultSet rs = ps.executeQuery();
   6:       
   7:       while(rs.next())
   8:       {

View Full Code Here
   1:       Connection conn = null;
   2:       PreparedStatement pstmt = null;
   3:       try {
   4:         ...
   5:           pstmt.setString(1, "id100");
   6:           rs = pstmt.executeQuery();
   7:           if (rs.next()) {
   8:              java.sql.Date dbSqlDate = rs.getDate(1);
   9:              java.sql.Time dbSqlTime = rs.getTime(2);

View Full Code Here
   1:      Connection con = null;    
   2:      PreparedStatement stat = null;    
   3:      ResultSet result = null;     
   4:         ...
   5:              stat.setString(1,emailid);
   6:       result=stat.executeQuery();
   7: 
   8:             while(result.next())        
   9:             {

View Full Code Here