Results 1 to 6 of 6

Thread: java.sql.SQLException{resolved}

Threaded View

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Question java.sql.SQLException{resolved}

    java.sql.SQLException: Before start of resultset. *** does this mean? :confuesd: I thought that my code might be positioning the pointer of the the bounds of the table stored in memory. Any ideas on what might be wrong?

    Thanks.

    Code:
    import java.sql.*; 
    
      public class SQL{
        public static void main(String[] agrs){  
    
        try{  
        int columns = 0; 
    
        Class.forName("com.mysql.jdbc.Driver").newInstance();
     
        Connection c = DriverManager.getConnection("jdbc:mysql://localhost/test");
     
       
        Statement s = c.createStatement();
        ResultSet rs = s.executeQuery("select * from ifilms"); 
        columns = (rs.getMetaData()).getColumnCount();
        for(int i = 0; i < columns; ++i){
          System.out.println(rs.getString(i));
        }
       /*
        boolean more = true; 
        int index = 0;  
        while(more){
          System.out.println(rs.getString(++index));
          more = rs.next();
        }
      */
        }catch(Exception e){
          System.out.println(e); 
       }
      }
     }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width