Tabnine Logo
DBI.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.skife.jdbi.v2.DBI
constructor

Best Java code snippets using org.skife.jdbi.v2.DBI.<init> (Showing top 20 results out of 576)

Refine searchRefine arrow

  • DBI.open
  • UUID.randomUUID
  • Handle.execute
  • Before.<init>
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: 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)");
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception {
  dbi = new DBI("jdbc:hsqldb:mem:" + UUID.randomUUID(), "username", "password");
  dbi.withHandle(new HandleCallback<Object>() {
    @Override
    public Object withHandle(Handle handle) throws Exception {
      handle.execute("create table something (id identity primary key, name varchar(32))");
      return null;
    }
  });
}
origin: org.jdbi/jdbi

@Test
public void testObtainHandleViaOpen() throws Exception
{
  DBI dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  Handle handle = dbi.open();
  // make sure to close it!
  handle.close();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception {
  dbi = new DBI("jdbc:oracle:thin:@localhost:test", "oracle", "oracle");
  dbi.withHandle(new HandleCallback<Object>() {
    public Object withHandle(Handle handle) throws Exception
    {
      handle.execute("create sequence something_id_sequence INCREMENT BY 1 START WITH 100");
      handle.execute("create table something (name varchar(200), id int, constraint something_id primary key (id))");
      return null;
    }
  });
}
origin: org.jdbi/jdbi

@BeforeClass
public static void init() {
  assumeTrue(Boolean.parseBoolean(System.getenv("TRAVIS")));
  handle = new DBI("jdbc:postgresql:jdbi_test", "postgres", "").open();
  handle.execute("create table something (id int primary key, name varchar(100))");
  handle.execute("insert into something(id, name) values(1, null)");
  handle.execute("insert into something(id, name) values(2, 'bla')");
  handle.execute("insert into something(id, name) values(3, 'null')");
  handle.execute("insert into something(id, name) values(4, '')");
}
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.kill-bill.commons/killbill-jdbi

@Test
public void testObtainHandleViaOpen() throws Exception
{
  DBI dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  Handle handle = dbi.open();
  // make sure to close it!
  handle.close();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception {
  dbi = new DBI("jdbc:postgresql:jdbi_test", "postgres", "");
  dbi.withHandle(new HandleCallback<Object>() {
    @Override
    public Object withHandle(Handle handle) throws Exception
    {
      handle.execute("CREATE FUNCTION set100(OUT outparam INT) AS $$ BEGIN outparam \\:= 100; END; $$ LANGUAGE plpgsql");
      return null;
    }
  });
}
origin: org.jdbi/jdbi

@Override
public void setUp() throws Exception
{
  JdbcDataSource ds = new JdbcDataSource();
  ds.setURL("jdbc:h2:mem:test");
  dbi = new DBI(ds);
  handle = dbi.open();
  handle.execute("create table something (id int primary key, name varchar(100), a varchar(100), b int, c varchar(100))");
}
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: 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 testAttachToObject() throws Exception
{
  DBI dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  Handle h = dbi.open();
  MyDAO dao = h.attach(MyDAO.class);
  // do stuff with the dao
  h.close();
}
origin: org.jdbi/jdbi

@Before
public void setUp() throws Exception {
  dbi = new DBI("jdbc:postgresql:jdbi_test", "postgres", "");
  dbi.withHandle(new HandleCallback<Object>() {
    @Override
    public Object withHandle(Handle handle) throws Exception
    {
      handle.execute("create sequence id_sequence INCREMENT 1 START WITH 100");
      handle.execute("create table if not exists something (name text, id int DEFAULT nextval('id_sequence'), CONSTRAINT something_id PRIMARY KEY ( id ));");
      return null;
    }
  });
}
origin: org.kill-bill.commons/killbill-jdbi

@Override
public void setUp() throws Exception
{
  JdbcDataSource ds = new JdbcDataSource();
  ds.setURL("jdbc:h2:mem:test");
  dbi = new DBI(ds);
  handle = dbi.open();
  handle.execute("create table something (id int primary key, name varchar(100), a varchar(100), b int, c varchar(100))");
}
origin: rakam-io/rakam

public PostgresqlLockService(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
{
  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 testAttachToObject() throws Exception
{
  DBI dbi = new DBI("jdbc:h2:mem:" + UUID.randomUUID());
  Handle h = dbi.open();
  MyDAO dao = h.attach(MyDAO.class);
  // do stuff with the dao
  h.close();
}
origin: org.kill-bill.commons/killbill-jdbi

@Before
public void setUp() throws Exception {
  dbi = new DBI("jdbc:postgresql:test", "postgres", "postgres");
  dbi.withHandle(new HandleCallback<Object>() {
    @Override
    public Object withHandle(Handle handle) throws Exception
    {
      handle.execute("create sequence id_sequence INCREMENT 1 START WITH 100");
      handle.execute("create table if not exists something (name text, id int DEFAULT nextval('id_sequence'), CONSTRAINT something_id PRIMARY KEY ( id ));");
      return null;
    }
  });
}
origin: rakam-io/rakam

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

Javadoc

Create a DBI which directly uses the DriverManager

Popular methods of DBI

  • open
  • 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
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • setScale (BigDecimal)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Path (java.nio.file)
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • JOptionPane (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top plugins for Android Studio
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