Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String printall() {
- String numusers = "";
- String dbUrl = "jdbc:derby://localhost:1527/autoviacao";
- String dbClass = "com.mysql.jdbc.Driver";
- String query = "select * from percursos";
- String userName = "root", password = "root";
- try {
- Class.forName("org.apache.derby.jdbc.ClientDriver");
- Connection con = DriverManager.getConnection (dbUrl, userName, password);
- Statement stmt = con.createStatement();
- ResultSet rs = stmt.executeQuery(query);
- while (rs.next()) {
- numusers += rs.getString("id")+","+
- rs.getString("origem")+","+
- rs.getString("destino")+","+
- rs.getString("partida")+","+
- rs.getString("tempo")+";";
- } //end while
- con.close();
- } //end try
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement