Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public Connection connect(String url, Properties info) throws SQLException {
- try {
- if (!acceptsURL(url)) {
- return null;
- }
- } catch (SQLException e) {
- throw new SQLException();
- }
- String username = info.getProperty("username", null);
- String password = info.getProperty("password", null);
- try {
- if (!canLogIn(username, password)) {
- // return null;
- }
- } catch (Exception e) {
- }
- if (!App.checkForExistence(info.get("path"))) {
- throw new SQLException();
- }
- File appDir = new File(info.get("path").toString());
- try {
- String writerType = url.substring(url.indexOf(':') + 1, url.lastIndexOf(':'));
- if (!appDir.exists()) {
- appDir.mkdirs();
- }
- return new eg.edu.alexu.csd.oop.DBMS.plugins.jdbc.Connection(appDir.getPath(),
- BackEndWriterFactory
- .getBackEndWriter(writerType.substring(0, writerType.length() - 2))); // the
- // url
- // is
- // on
- // the
- // form
- // ***db
- } catch (Exception e) {
- throw new SQLException();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement