Created
December 15, 2016 12:21
-
-
Save volkov/fbe82f6d14cd4c6e44b3913653863ad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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