Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Statement stmt = null;
- try {
- String URL = "jdbc:mysql://localhost:3306/test";
- Connection conn = DriverManager.getConnection(URL, "****", "****");
- stmt = conn.createStatement(
- ResultSet.TYPE_SCROLL_SENSITIVE,
- ResultSet.CONCUR_UPDATABLE
- );
- String query = "SELECT * FROM pers";
- ResultSet res = stmt.executeQuery(query);
- if (res.absolute(3)) {
- res.updateString("name", "Xxxx Yyyy");
- res.updateInt("age", 48);
- res.updateRow();
- }
- } catch (SQLException ex) {
- System.out.println(ex);
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- System.out.println("Database Connection closed");
- } catch (SQLException ex) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement