Code example for Connection

Methods: createStatement

0
		 
		// connect to database (created automatically if not existing) 
        conn = DriverManager.getConnection("jdbc:h2:" + databaseDirectory + "/" + databaseName + jdbcString, "sa", "");
 
        // create cache table if it does not exist 
        Statement stmt = conn.createStatement();
        stmt.execute("DROP TABLE IF EXISTS QUERY_CACHE");
        stmt.execute("CREATE TABLE IF NOT EXISTS QUERY_CACHE(QUERYHASH BINARY PRIMARY KEY, TRIPLES CLOB, STORE_TIME TIMESTAMP)");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		} 
	} 
	 
	private void fillCache(){ 
		logger.info("Filling cache..."); 
		int cnt = getResourcesCount();
		logger.info("Number of resources: " + cnt);
		List<String> resources;
Stop searching for code, let great code find you!  Add Codota to your java IDE