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);
}
}
}