Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement