Source Code : Using the RowSetFactory class
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Using the RowSetFactory class
import javax.sql.rowset.JdbcRowSet;
import javax.sql.rowset.RowSetFactory;
import javax.sql.rowset.RowSetProvider;
public class Test {
public static void main(String[] args) throws Exception {
String databaseUrl = "jdbc:derby://localhost:1527/contact";
String username = "user";
String password = "password";
RowSetFactory rowSetFactory = null;
rowSetFactory = RowSetProvider.newFactory(
"com.sun.rowset.RowSetFactoryImpl", null);
JdbcRowSet rowSet = rowSetFactory.createJdbcRowSet();
rowSet.setUrl(databaseUrl);
rowSet.setUsername(username);
rowSet.setPassword(password);
rowSet.setCommand("SELECT * FROM COLLEAGUES");
rowSet.execute();
while (rowSet.next()) {
System.out.println(rowSet.getInt("ID") + " - "
+ rowSet.getString("FIRSTNAME"));
}
}
}
Thank with us