Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Application implements RequestHandler<Object, Boolean> {
- private Logger logger = Logger.getLogger(Application.class);
- public Boolean handleRequest(Object object, Context context) {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- logger.info("Calling DriverManager.getConnection()");
- Connection con = DriverManager.getConnection(
- "jdbc:mysql://...endpoint...defaultdb",
- "awsops",
- "..."
- );
- Statement stmt = con.createStatement();
- logger.info("Test Started!");
- ResultSet result = stmt.executeQuery("SELECTn" +
- " last_name, COUNT(*)n" +
- "FROMn" +
- " usersn" +
- "GROUP BYn" +
- " last_namen" +
- "HAVING COUNT(*) > 1");
- if (result.next()) {
- logger.info(result.getString("last_name"));
- }
- return true;
- } catch (Exception e) {
- logger.info(e.getLocalizedMessage());
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement