Exemplo n.º 1
0
 public static synchronized FileSystemDatabase register(String url) {
   Connection conn;
   try {
     if (url.startsWith("jdbc:h2:")) {
       // avoid using DriverManager if possible
       conn = Driver.load().connect(url, new Properties());
     } else {
       conn = JdbcUtils.getConnection(null, url, new Properties());
     }
     boolean log = url.toUpperCase().indexOf("TRACE_") >= 0;
     FileSystemDatabase fs = new FileSystemDatabase(url, conn, log);
     FileSystem.register(fs);
     return fs;
   } catch (SQLException e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 2
0
 /** Close the underlying database and unregister the file system. */
 public void unregister() {
   JdbcUtils.closeSilently(conn);
   FileSystem.unregister(this);
 }