Tabnine Logo
DBI.open
Code IndexAdd Tabnine to your IDE (free)

How to use
open
method
in
org.skife.jdbi.v2.DBI

Best Java code snippets using org.skife.jdbi.v2.DBI.open (Showing top 20 results out of 324)

Refine searchRefine arrow

  • DBI.<init>
  • UUID.randomUUID
  • Handle.execute
  • Test.<init>
origin: dropwizard/dropwizard

@Override
protected Result check() throws Exception {
  return timeBoundHealthCheck.check(() -> {
    try (Handle handle = dbi.open()) {
      handle.execute(validationQuery);
      return Result.healthy();
    }
  });
}
origin: apache/incubator-druid

public void tearDown()
{
 try {
  new DBI(jdbcUri + ";drop=true").open().close();
 }
 catch (UnableToObtainConnectionException e) {
  SQLException cause = (SQLException) e.getCause();
  // error code "08006" indicates proper shutdown
  Assert.assertEquals(StringUtils.format("Derby not shutdown: [%s]", cause.toString()), "08006", cause.getSQLState());
 }
}
origin: apache/hive

@Test public void testPreCreateTableWillCreateSegmentsTable() throws MetaException {
 try (Handle handle = derbyConnectorRule.getConnector().getDBI().open()) {
  Assert.assertFalse(derbyConnectorRule.getConnector().tableExists(handle, segmentsTable));
  druidStorageHandler.preCreateTable(tableMock);
  Assert.assertTrue(derbyConnectorRule.getConnector().tableExists(handle, segmentsTable));
 }
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception
{
  dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  handle = dbi.open();
  handle.execute("create table something( id integer primary key, name varchar(100) )");
}
origin: org.jdbi/jdbi

@Test
public void testDataSourceConstructor() throws Exception
{
  DBI dbi = new DBI(DERBY_HELPER.getDataSource());
  Handle h = dbi.open();
  assertNotNull(h);
  h.close();
}
origin: org.kill-bill.commons/killbill-jdbi

@Test
public void testJustJdbiTransactions() throws Exception
{
  Handle h1 = dbi.open();
  Handle h2 = dbi.open();
  h1.execute("insert into something (id, name) values (8, 'Mike')");
  h1.begin();
  h1.execute("update something set name = 'Miker' where id = 8");
  assertEquals("Mike", h2.createQuery("select name from something where id = 8").map(StringMapper.FIRST).first());
  h1.commit();
  h1.close();
  h2.close();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception
{
  dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  handle = dbi.open();
  handle.execute("create table something (id int primary key, name varchar(100))");
}
origin: org.jdbi/jdbi

  @Test
  public void testBaz() throws Exception
  {
    Handle h = dbi.open();
    h.insert("insert into something (id, name) values (1, 'Keith')");
  }
}
origin: org.kill-bill.commons/killbill-jdbi

@Test
public void testDataSourceConstructor() throws Exception
{
  DBI dbi = new DBI(DERBY_HELPER.getDataSource());
  Handle h = dbi.open();
  assertNotNull(h);
  h.close();
}
origin: org.jdbi/jdbi

@Test
public void testJustJdbiTransactions() throws Exception
{
  Handle h1 = dbi.open();
  Handle h2 = dbi.open();
  h1.execute("insert into something (id, name) values (8, 'Mike')");
  h1.begin();
  h1.execute("update something set name = 'Miker' where id = 8");
  assertEquals("Mike", h2.createQuery("select name from something where id = 8").mapTo(String.class).first());
  h1.commit();
  h1.close();
  h2.close();
}
origin: apache/hive

public void tearDown() {
 try {
  new DBI(jdbcUri + ";drop=true").open().close();
 } catch (UnableToObtainConnectionException e) {
  SQLException cause = (SQLException) e.getCause();
  // error code "08006" indicates proper shutdown
  Assert.assertEquals(String.format("Derby not shutdown: [%s]", cause.toString()), "08006",
      cause.getSQLState()
  );
 }
}
origin: HubSpot/Singularity

@After
public void blowDBAway() {
 Handle handle = dbiProvider.get().open();
 handle.execute("DELETE FROM taskHistory;DELETE FROM requestHistory;DELETE FROM deployHistory;");
 handle.close();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception
{
  dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  handle = dbi.open();
  handle.execute("create table something (id int primary key, name varchar(100))");
}
origin: org.kill-bill.commons/killbill-jdbi

  @Test
  public void testBaz() throws Exception
  {
    Handle h = dbi.open();
    h.insert("insert into something (id, name) values (1, 'Keith')");
  }
}
origin: rakam-io/rakam

public PostgresqlLockService(JDBCPoolDataSource poolDataSource) {
  this.dbi = new DBI(() -> {
    return poolDataSource.getConnection(true);
  });
  this.currentHandle = dbi.open();
  locks = new ConcurrentSkipListSet<>();
}
origin: rakam-io/rakam

private void addColumn(Table table, String schema, String tableName, String columnName, FieldType fieldType) {
  List<TableColumn> existingColumns = dao.listTableColumns(schema, tableName);
  TableColumn lastColumn = existingColumns.get(existingColumns.size() - 1);
  long columnId = lastColumn.getColumnId() + 1;
  int ordinalPosition = existingColumns.size();
  String type = TypeSignature.parseTypeSignature(toSql(fieldType)).toString().toLowerCase(ENGLISH);
  daoTransaction(dbi, MetadataDao.class, dao -> {
    dao.insertColumn(table.getTableId(), columnId, columnName, ordinalPosition, type, null, null);
    dao.updateTableVersion(table.getTableId(), System.currentTimeMillis());
  });
  String columnType = sqlColumnType(fieldType);
  if (columnType == null) {
    return;
  }
  String sql = format("ALTER TABLE %s ADD COLUMN (%s %s, %s %s)",
      shardIndexTable(table.getTableId()),
      minColumn(columnId), columnType,
      maxColumn(columnId), columnType);
  try (Handle handle = dbi.open()) {
    handle.execute(sql);
  } catch (DBIException e) {
    throw metadataError(e);
  }
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception
{
  DBI dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  handle = dbi.open();
  handle.execute("create table something (id int primary key, name varchar(100))");
}
origin: org.jdbi/jdbi

@Test
public void testDoubleArgumentBind() throws Exception
{
  Doubler d = dbi.open(Doubler.class);
  assertTrue(d.doubleTest("wooooot"));
}
origin: rakam-io/rakam

public MysqlLockService(JDBCPoolDataSource poolDataSource) {
  this.dbi = new DBI(() -> {
    return poolDataSource.getConnection(true);
  });
  this.currentHandle = dbi.open();
  locks = new ConcurrentSkipListSet<>();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception
{
  this.dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  this.h = dbi.open();
  h.execute("create table something (id int primary key, name varchar)");
}
org.skife.jdbi.v2DBIopen

Javadoc

Obtain a Handle to the data source wrapped by this DBI instance

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • onDemand
    Create a new sql object which will obtain and release connections from this dbi instance, as it need
  • registerMapper
    Register a result set mapper which will have its parameterized type inspected to determine what it m
  • withHandle
    A convenience function which manages the lifecycle of a handle and yields it to a callback for use b
  • registerArgumentFactory
  • inTransaction
  • setSQLLog
    Specify the class used to log sql statements. Will be passed to all handles created from this instan
  • registerContainerFactory
  • setStatementLocator
    Use a non-standard StatementLocator to look up named statements for all handles created from this DB
  • setStatementRewriter
    Use a non-standard StatementRewriter to transform SQL for all Handle instances created by this DBI.
  • setTransactionHandler
    Specify the TransactionHandler instance to use. This allows overriding transaction semantics, or map
  • setTimingCollector
    Add a callback to accumulate timing information about the queries running from this data source.
  • setTransactionHandler,
  • setTimingCollector,
  • useHandle,
  • define,
  • close,
  • getStatementLocator,
  • getTransactionHandler,
  • registerColumnMapper

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • getContentResolver (Context)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now