--- /dev/null
+package net.jaekl.squelch.db;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+
+public abstract class DbDriver {
+ // Returns true iff. this DbDriver knows how to connect to the given JDBC URL
+ abstract public boolean handles(String jdbcUrl);
+
+ // Execute line as a statement of this type
+ abstract String getJdbcDriverClassName();
+
+ // Open a new Connection to the database. Note that the caller must close() this at some point.
+ public Connection connect(String jdbcUrl, String userName, String password) throws ClassNotFoundException, SQLException
+ {
+ Class.forName(getJdbcDriverClassName());
+ return DriverManager.getConnection(jdbcUrl, userName, password);
+ }
+}