diff options
Diffstat (limited to 'src/Store/ConnectionHandler.java')
-rw-r--r-- | src/Store/ConnectionHandler.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Store/ConnectionHandler.java b/src/Store/ConnectionHandler.java new file mode 100644 index 0000000..45d4446 --- /dev/null +++ b/src/Store/ConnectionHandler.java @@ -0,0 +1,28 @@ +package Store; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class ConnectionHandler { + String address; + public static Connection connection; + + public ConnectionHandler(String address) { + this.address = address; + } + + public void connect() { + try { + connection = DriverManager.getConnection(this.address); + + // create tables if they don't exist + Book.createTable(); + User.createTable(); + } catch (SQLException e) { + System.err.println(e.getMessage()); + } + } + + // TODO: disconnect +} |