Guest User

Untitled

a guest
Oct 9th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import java.sql.ResultSet;
  2. import java.sql.SQLException;
  3.  
  4. import mirco.db.*;
  5.  
  6. public class Example {
  7. public static void main(String[] args) throws SQLException, InterruptedException {
  8. ConnectionsPool pool = new ConnectionsPool(new PoolSettings("jdbc:mysql://server/db"));
  9.  
  10. Database db = null;
  11. try {
  12. db = pool.take();
  13.  
  14. ResultSet res = null;
  15. try {
  16. res = db.query("select name from table users where age >= ?", 21);
  17.  
  18. while (res.next()) {
  19. System.out.println(res.getString("name"));
  20. }
  21. } finally {
  22. db.cleanup(res);
  23. }
  24. } finally {
  25. pool.release(db);
  26. }
  27.  
  28. pool.disconnect();
  29. }
  30. }
Add Comment
Please, Sign In to add comment