import javax.sql.rowset.JdbcRowSet;
import javax.sql.rowset.RowSetProvider;
//This feature is added as part of JAVA 7.
public class RowSet1 {
public static void main(String[] args) throws Exception
{
Class.forName("org.apache.derby.jdbc.ClientDriver");
String url = "jdbc:derby://localhost:1527/hari";
JdbcRowSet rs = RowSetProvider.newFactory().createJdbcRowSet();
rs.setUrl(url);
rs.setUsername("app");
rs.setPassword("app");
rs.setCommand("select * from MYEMP");
rs.execute();
while(rs.next()){
System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getFloat(3)+" "+rs.getString(4));
}
}
}
No comments:
Post a Comment