List of usage examples for javax.sql.rowset JdbcRowSet setPassword
void setPassword(String password) throws SQLException;
RowSet
object to the given String
. From source file:Test.java
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);/*from w w w.ja v a 2s .c om*/ 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")); } }
From source file:com.kumarvv.setl.utils.RowSetUtil.java
/** * @return builds and returns source row set *//*w ww .j a va 2 s . c o m*/ public JdbcRowSet getRowSet(DS ds) throws SQLException { if (ds == null) { throw new SQLException("Invalid DS"); } if (rowSetFactory == null) { rowSetFactory = RowSetProvider.newFactory(); } loadDriver(ds); JdbcRowSet jrs = rowSetFactory.createJdbcRowSet(); jrs.setUrl(ds.getUrl()); jrs.setUsername(ds.getUsername()); jrs.setPassword(ds.getPassword()); return jrs; }