Skip to content

Instantly share code, notes, and snippets.

@volkov
Created December 15, 2016 12:21
Show Gist options
  • Save volkov/fbe82f6d14cd4c6e44b3913653863ad2 to your computer and use it in GitHub Desktop.
Save volkov/fbe82f6d14cd4c6e44b3913653863ad2 to your computer and use it in GitHub Desktop.
public class TestDao {
private final Connection connection;
public TestDao() throws SQLException {
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/testdb", "root", "9891");
}
public void doUpdate() throws SQLException {
try (Statement statement = connection.createStatement();) {
statement.executeUpdate("INSERT INTO PHOTOS (photo_id, photo_name) VALUES (5, 'dsv')");
}
}
public void close() throws SQLException {
connection.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment