org.apache.derby.jdbc.EmbeddedDriver Java Examples
The following examples show how to use
org.apache.derby.jdbc.EmbeddedDriver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DerbyEmbeddedDatabaseConfigurer.java From spring-analysis-note with MIT License | 5 votes |
@Override public void configureConnectionProperties(ConnectionProperties properties, String databaseName) { properties.setDriverClass(EmbeddedDriver.class); properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true")); properties.setUsername("sa"); properties.setPassword(""); }
Example #2
Source File: DerbyEmbeddedDatabaseConfigurer.java From spring-analysis-note with MIT License | 5 votes |
@Override public void shutdown(DataSource dataSource, String databaseName) { try { new EmbeddedDriver().connect( String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties()); } catch (SQLException ex) { // Error code that indicates successful shutdown if (!"08006".equals(ex.getSQLState())) { LogFactory.getLog(getClass()).warn("Could not shut down embedded Derby database", ex); } } }
Example #3
Source File: DerbyEmbeddedDatabaseConfigurer.java From java-technology-stack with MIT License | 5 votes |
@Override public void configureConnectionProperties(ConnectionProperties properties, String databaseName) { properties.setDriverClass(EmbeddedDriver.class); properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true")); properties.setUsername("sa"); properties.setPassword(""); }
Example #4
Source File: DerbyEmbeddedDatabaseConfigurer.java From java-technology-stack with MIT License | 5 votes |
@Override public void shutdown(DataSource dataSource, String databaseName) { try { new EmbeddedDriver().connect( String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties()); } catch (SQLException ex) { // Error code that indicates successful shutdown if (!"08006".equals(ex.getSQLState())) { LogFactory.getLog(getClass()).warn("Could not shut down embedded Derby database", ex); } } }
Example #5
Source File: BeejuCore.java From beeju with Apache License 2.0 | 5 votes |
public BeejuCore(String databaseName, Map<String, String> configuration) { checkNotNull(databaseName, "databaseName is required"); this.databaseName = databaseName; if (configuration != null && !configuration.isEmpty()) { for (Map.Entry<String, String> entry : configuration.entrySet()) { conf.set(entry.getKey(), entry.getValue()); } } driverClassName = EmbeddedDriver.class.getName(); conf.setBoolean("hcatalog.hive.client.cache.disabled", true); connectionURL = "jdbc:derby:memory:" + UUID.randomUUID() + ";create=true"; conf.setVar(HiveConf.ConfVars.METASTORECONNECTURLKEY, connectionURL); conf.setVar(HiveConf.ConfVars.METASTORE_CONNECTION_DRIVER, driverClassName); conf.setVar(HiveConf.ConfVars.METASTORE_CONNECTION_USER_NAME, METASTORE_DB_USER); conf.setVar(HiveConf.ConfVars.METASTOREPWD, METASTORE_DB_PASSWORD); conf.setBoolVar(HiveConf.ConfVars.HMSHANDLERFORCERELOADCONF, true); // Hive 2.x compatibility conf.setBoolean("datanucleus.schema.autoCreateAll", true); conf.setBoolean("hive.metastore.schema.verification", false); // override default port as some of our test environments claim it is in use. conf.setInt("hive.server2.webui.port", 0); // ConfVars.HIVE_SERVER2_WEBUI_PORT try { // overriding default derby log path to go to tmp String derbyLog = File.createTempFile("derby", ".log").getCanonicalPath(); System.setProperty("derby.stream.error.file", derbyLog); //Creating temporary folder createWarehousePath(); } catch (IOException e) { throw new RuntimeException(e); } }
Example #6
Source File: BeejuCoreTest.java From beeju with Apache License 2.0 | 5 votes |
@Test public void checkConfig() { assertThat(defaultCore.driverClassName(), is(EmbeddedDriver.class.getName())); assertThat(defaultCore.conf().getVar(HiveConf.ConfVars.METASTORECONNECTURLKEY), is(defaultCore.connectionURL())); assertThat(defaultCore.conf().getVar(HiveConf.ConfVars.METASTORE_CONNECTION_DRIVER), is(defaultCore.driverClassName())); assertThat(defaultCore.conf().getVar(HiveConf.ConfVars.METASTORE_CONNECTION_USER_NAME), is("db_user")); assertThat(defaultCore.conf().getVar(HiveConf.ConfVars.METASTOREPWD), is("db_password")); assertThat(defaultCore.conf().getBoolVar(HiveConf.ConfVars.HMSHANDLERFORCERELOADCONF), is(true)); assertThat(defaultCore.conf().get("datanucleus.schema.autoCreateAll"), is("true")); assertThat(defaultCore.conf().get("hive.metastore.schema.verification"), is("false")); assertThat(defaultCore.conf().get("hive.server2.webui.port"), is("0")); assertThat(defaultCore.conf().get("hcatalog.hive.client.cache.disabled"), is("true")); }
Example #7
Source File: DerbyEmbeddedDatabaseConfigurer.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void configureConnectionProperties(ConnectionProperties properties, String databaseName) { properties.setDriverClass(EmbeddedDriver.class); properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true")); properties.setUsername("sa"); properties.setPassword(""); }
Example #8
Source File: DerbyEmbeddedDatabaseConfigurer.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void shutdown(DataSource dataSource, String databaseName) { try { new EmbeddedDriver().connect( String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties()); } catch (SQLException ex) { // Error code that indicates successful shutdown if (!"08006".equals(ex.getSQLState())) { LogFactory.getLog(getClass()).warn("Could not shut down embedded Derby database", ex); } } }
Example #9
Source File: DerbyEmbeddedDatabaseConfigurer.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void configureConnectionProperties(ConnectionProperties properties, String databaseName) { properties.setDriverClass(EmbeddedDriver.class); properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true")); properties.setUsername("sa"); properties.setPassword(""); }
Example #10
Source File: DerbyEmbeddedDatabaseConfigurer.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public void shutdown(DataSource dataSource, String databaseName) { try { new EmbeddedDriver().connect( String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties()); } catch (SQLException ex) { // Error code that indicates successful shutdown if (!"08006".equals(ex.getSQLState())) { LogFactory.getLog(getClass()).warn("Could not shut down embedded Derby database", ex); } } }
Example #11
Source File: JDBCMailRepositoryTest.java From james-project with Apache License 2.0 | 5 votes |
private BasicDataSource getDataSource() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(EmbeddedDriver.class.getName()); ds.setUrl("jdbc:derby:target/testdb;create=true"); ds.setUsername("james"); ds.setPassword("james"); return ds; }
Example #12
Source File: DerbyEmbeddedDatabaseConfigurer.java From effectivejava with Apache License 2.0 | 5 votes |
@Override public void configureConnectionProperties(ConnectionProperties properties, String databaseName) { properties.setDriverClass(EmbeddedDriver.class); properties.setUrl(String.format(URL_TEMPLATE, databaseName, "create=true")); properties.setUsername("sa"); properties.setPassword(""); }
Example #13
Source File: DerbyEmbeddedDatabaseConfigurer.java From effectivejava with Apache License 2.0 | 5 votes |
@Override public void shutdown(DataSource dataSource, String databaseName) { try { new EmbeddedDriver().connect( String.format(URL_TEMPLATE, databaseName, "drop=true"), new Properties()); } catch (SQLException ex) { // Error code that indicates successful shutdown if (!"08006".equals(ex.getSQLState())) { LogFactory.getLog(getClass()).warn("Could not shutdown in-memory Derby database", ex); } } }
Example #14
Source File: EarWarResourcesXmlTest.java From tomee with Apache License 2.0 | 5 votes |
@Deployment public static Archive<?> app() { return ShrinkWrap.create(EnterpriseArchive.class, "EarWarResourcesXmlTest.ear") .addAsModule(ShrinkWrap.create(WebArchive.class, "web.war") .addClass(EarWarResourcesXmlTest.class) .addAsLibraries(jarLocation(EmbeddedDriver.class)) .addAsWebInfResource(new StringAsset("<resources>\n" + " <Resource id=\"derby\" type=\"DataSource\">\n" + " JdbcDriver = org.apache.derby.jdbc.EmbeddedDriver\n" + " JdbcUrl = jdbc:derby:memory:EarWarResourcesXmlTest;create=true\n" + " UserName = SA\n" + " Lazy = true\n" + " </Resource>\n" + "</resources>"), "resources.xml")); }
Example #15
Source File: ContainerLifecycle.java From incubator-batchee with Apache License 2.0 | 5 votes |
@Override public void onStart(final ITestContext iTestContext) { final String loggerName = "test-lifecycle"; container = EJBContainer.createEJBContainer(new PropertiesBuilder() .p("openejb.jul.forceReload", Boolean.TRUE.toString()) .p("openejb.log.color", Boolean.toString(!System.getProperty("os.name").toLowerCase().contains("win"))) .p(loggerName + ".level", "INFO") .p("openejb.jdbc.log", Boolean.FALSE.toString()) // with jdbc set it to TRUE to get sql queries .p("jdbc/orderDB", "new://Resource?type=DataSource") .p("jdbc/orderDB.JdbcDriver", EmbeddedDriver.class.getName()) .p("jdbc/orderDB.JdbcUrl", "jdbc:derby:memory:orderDB" + ";create=true") .p("jdbc/orderDB.UserName", "app") .p("jdbc/orderDB.Password", "app") .p("jdbc/orderDB.JtaManaged", Boolean.TRUE.toString()) .p("jdbc/batchee", "new://Resource?type=DataSource") .p("jdbc/batchee.JdbcDriver", EmbeddedDriver.class.getName()) .p("jdbc/batchee.JdbcUrl", "jdbc:derby:memory:batchee" + ";create=true") .p("jdbc/batchee.UserName", "app") .p("jdbc/batchee.Password", "app") .p("jdbc/batchee.JtaManaged", Boolean.FALSE.toString()) .build()); logger = Logger.getLogger(loggerName); }