Code example for Statement

Methods: execute, executeQuery, executeUpdate

0
	public void testJDBC(String url) throws SQLException
	{ 
			Connection conn;
			conn = DriverManager.getConnection(url, null, null);
			Statement stmt = conn.createStatement();
			stmt.execute("CREATE TABLE IF NOT EXISTS TESTTABLE(TESTCOLUMN VARCHAR(100));");
			stmt.executeUpdate("INSERT INTO TESTTABLE VALUES ('TESTDATUM');");
 
			ResultSet rs = stmt.executeQuery("SELECT * FROM TESTTABLE;");
			rs.next();
			String datum = rs.getString(1);
			rs.close();
			conn.close();			
			assertTrue(datum.equals("TESTDATUM"));
	} 
	 
	@Test public void testExtractionDBCache() throws SQLException 
	{		 
		// "hack" get a memory connection. we shouldn't be able to write to etc so this would throw an error if it tries on-disk cache 
		// TODO: if feature request gets implemented, use ExtractionDBCache(Connection) 
		//ExtractionDBCacheUtils.setCacheDir("cache");