Codota Logo
DBI.useHandle
Code IndexAdd Codota to your IDE (free)

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

Best Java code snippets using org.skife.jdbi.v2.DBI.useHandle (Showing top 9 results out of 315)

  • Common ways to obtain DBI
private void myMethod () {
DBI d =
  • Codota IconDataSource dataSource;new DBI(dataSource)
  • Codota IconConnectionFactory connectionFactory;new DBI(connectionFactory)
  • Codota IconString url;String username;String password;new DBI(url, username, password)
  • Smart code suggestions by Codota
}
origin: io.syndesis.rest/rest-filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis/filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis.server/server-filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: io.syndesis/filestore

@SuppressWarnings("PMD.EmptyCatchBlock")
public void destroy() {
  try {
    dbi.useHandle(h -> h.execute("DROP TABLE icon_filestore"));
  } catch (CallbackFailedException ex) {
    // simply ignore
  }
}
origin: org.jdbi/jdbi

  @Test
  public void testUseHandle() throws Exception
  {
    DBI dbi = new DBI(DERBY_HELPER.getDataSource());
    dbi.useHandle(new HandleConsumer() {
      @Override
      public void useHandle(Handle handle) throws Exception {
        handle.insert("insert into something (id, name) values (1, 'Brian')");
        String value = handle.createQuery("select name from something where id = 1").map(Something.class).first().getName();
        assertEquals("Brian", value);
      }
    });
  }
}
origin: io.syndesis.rest/rest-filestore

public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new DaoException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new DaoException("Unable to initialize the filestore", ex);
    }
  }
}
origin: io.syndesis/filestore

@Override
public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "icon_filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE icon_filestore (id VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new IconDataAccessException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new IconDataAccessException("Unable to initialize the icon_filestore", ex);
    }
  }
}
origin: io.syndesis.server/server-filestore

public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new DaoException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new DaoException("Unable to initialize the filestore", ex);
    }
  }
}
origin: io.syndesis/filestore

@Override
public void init() {
  boolean needsInitialization = !dbi.inTransaction((h, s) -> tableExists(h, "filestore"));
  if (needsInitialization) {
    try {
      dbi.useHandle(h -> {
        if (databaseKind == DatabaseKind.PostgreSQL) {
          h.execute("CREATE TABLE filestore (path VARCHAR COLLATE \"C\" PRIMARY KEY, data OID)");
        } else if (databaseKind == DatabaseKind.H2) {
          h.execute("CREATE TABLE filestore (path VARCHAR PRIMARY KEY, data BLOB)");
        } else if (databaseKind == DatabaseKind.Apache_Derby) {
          h.execute("CREATE TABLE filestore (path VARCHAR(1000), data BLOB, PRIMARY KEY (path))");
        } else {
          throw new ExtensionDataAccessException("Unsupported database kind: " + databaseKind);
        }
      });
    } catch (CallbackFailedException ex) {
      throw new ExtensionDataAccessException("Unable to initialize the filestore", ex);
    }
  }
}
org.skife.jdbi.v2DBIuseHandle

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • 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
  • setStatementRewriter,
  • setTransactionHandler,
  • setTimingCollector,
  • define,
  • close,
  • getStatementLocator,
  • getTransactionHandler,
  • registerColumnMapper

Popular in Java

  • Start an intent from android
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now