Guest User

Untitled

a guest
May 20th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import java.sql.DriverManager;
  2. import java.sql.PreparedStatement;
  3. import java.sql.SQLException;
  4. import java.sql.Connection;
  5. public class getInfoDBemp {
  6. private static final String JDBC_URL = "jdbc:derby:EvCo-RegHuella;";
  7. Connection conn;
  8. public getInfoDBemp () {
  9. try {
  10. this.conn = DriverManager.getConnection(JDBC_URL);
  11. if (this.conn != null) {
  12. try {
  13. PreparedStatement ps = this.conn.prepareStatement(main.statementEmpreg);
  14. ps.execute();
  15. while (ps.getMoreResults()) {
  16. String testprint = ps.getResultSet().toString();
  17. System.out.println(testprint);
  18. }
  19. ps.close();
  20. }catch(SQLException ex){
  21. String exString = ex.toString();
  22. System.out.println("ERROR " + exString);
  23. }
  24. }
  25. }catch (SQLException e) {
  26. System.out.print(e);
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment