Codota Logo
LocalJDBCConnectionUtils
Code IndexAdd Codota to your IDE (free)

How to use
LocalJDBCConnectionUtils
in
it.unibz.inf.ontop.utils

Best Java code snippets using it.unibz.inf.ontop.utils.LocalJDBCConnectionUtils (Showing top 9 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
OutputStreamWriter o =
  • Codota IconOutputStream out;new OutputStreamWriter(out)
  • Codota IconOutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
  • Codota IconHttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
  • Smart code suggestions by Codota
}
origin: ontop/ontop

  /**
   * TODO: what about the JDBC driver class name?
   */
  @Override
  public Connection getConnection() throws SQLException {
    return LocalJDBCConnectionUtils.createConnection(settings);
  }
}
origin: ontop/ontop

/**
 * Keeps a permanent connection to the DB (if enabled in the settings).
 *
 * Needed by some in-memory DBs (such as H2).
 *
 */
public boolean connect() throws OntopConnectionException {
  try {
    if (localConnection != null && !localConnection.isClosed()) {
      return true;
    }
    if (settings.isPermanentDBConnectionEnabled()) {
      localConnection = LocalJDBCConnectionUtils.createConnection(settings);
      return localConnection != null;
    }
  } catch (SQLException e) {
    throw new OntopConnectionException(e);
  }
  return true;
}
origin: it.unibz.inf.ontop/ontop-system-sql-core

/**
 * Keeps a permanent connection to the DB (if enabled in the settings).
 *
 * Needed by some in-memory DBs (such as H2).
 *
 */
public boolean connect() throws OntopConnectionException {
  try {
    if (localConnection != null && !localConnection.isClosed()) {
      return true;
    }
    if (settings.isPermanentDBConnectionEnabled()) {
      localConnection = LocalJDBCConnectionUtils.createConnection(settings);
      return localConnection != null;
    }
  } catch (SQLException e) {
    throw new OntopConnectionException(e);
  }
  return true;
}
origin: ontop/ontop

/***
 * extract mappings from given datasource, and insert them into the pre-processed mapping
 *
 * Duplicate Exception may happen,
 * since mapping id is generated randomly and same id may occur
 */
private SQLPPMapping bootstrapMappings(SQLPPMapping ppMapping)
    throws SQLException, DuplicateMappingException {
  if (ppMapping == null) {
    throw new IllegalArgumentException("Model should not be null");
  }
  try (Connection conn = LocalJDBCConnectionUtils.createConnection(settings)) {
    RDBMetadata metadata = RDBMetadataExtractionTools.createMetadata(conn, typeFactory, jdbcTypeMapper);
    // this operation is EXPENSIVE
    RDBMetadataExtractionTools.loadMetadata(metadata, conn, null);
    return bootstrapMappings(metadata, ppMapping);
  }
}
origin: it.unibz.inf.ontop/ontop-mapping-sql-owlapi

/***
 * extract mappings from given datasource, and insert them into the pre-processed mapping
 *
 * Duplicate Exception may happen,
 * since mapping id is generated randomly and same id may occur
 */
private SQLPPMapping bootstrapMappings(SQLPPMapping ppMapping)
    throws SQLException, DuplicateMappingException {
  if (ppMapping == null) {
    throw new IllegalArgumentException("Model should not be null");
  }
  try (Connection conn = LocalJDBCConnectionUtils.createConnection(settings)) {
    RDBMetadata metadata = RDBMetadataExtractionTools.createMetadata(conn);
    // this operation is EXPENSIVE
    RDBMetadataExtractionTools.loadMetadata(metadata, conn, null);
    return bootstrapMappings(metadata, ppMapping);
  }
}
origin: ontop/ontop

/**
 * Makes use of the DB connection
 */
private RDBMetadata extractDBMetadata(SQLPPMapping ppMapping, Optional<RDBMetadata> optionalDBMetadata,
                   OBDASpecInput specInput)
    throws DBMetadataExtractionException {
  boolean isDBMetadataProvided = optionalDBMetadata.isPresent();
  /*
   * Metadata extraction can be disabled when DBMetadata is already provided
   */
  if (isDBMetadataProvided && (!settings.isProvidedDBMetadataCompletionEnabled()))
    return optionalDBMetadata.get();
  try (Connection localConnection = LocalJDBCConnectionUtils.createConnection(settings)) {
    return isDBMetadataProvided
        ? dbMetadataExtractor.extract(ppMapping, localConnection, optionalDBMetadata.get(),
        specInput.getConstraintFile())
        : dbMetadataExtractor.extract(ppMapping, localConnection, specInput.getConstraintFile());
  }
  /*
   * Problem while creating the connection
   */
  catch (SQLException e) {
    throw new DBMetadataExtractionException(e.getMessage());
  }
}
origin: it.unibz.inf.ontop/ontop-mapping-sql-core

/**
 * Makes use of the DB connection
 */
private RDBMetadata extractDBMetadata(final SQLPPMapping ppMapping, Optional<RDBMetadata> optionalDBMetadata,
                   OBDASpecInput specInput)
    throws DBMetadataExtractionException, MetaMappingExpansionException {
  boolean isDBMetadataProvided = optionalDBMetadata.isPresent();
  /*
   * Metadata extraction can be disabled when DBMetadata is already provided
   */
  if (isDBMetadataProvided && (!settings.isProvidedDBMetadataCompletionEnabled()))
    return optionalDBMetadata.get();
  try (Connection localConnection = LocalJDBCConnectionUtils.createConnection(settings)) {
    return isDBMetadataProvided
        ? dbMetadataExtractor.extract(ppMapping, localConnection, optionalDBMetadata.get(),
        specInput.getConstraintFile())
        : dbMetadataExtractor.extract(ppMapping, localConnection, specInput.getConstraintFile());
  }
  /*
   * Problem while creating the connection
   */
  catch (SQLException e) {
    throw new DBMetadataExtractionException(e.getMessage());
  }
}
origin: it.unibz.inf.ontop/ontop-mapping-sql-core

protected SQLPPMapping expandPPMapping(SQLPPMapping ppMapping, OntopMappingSQLSettings settings, RDBMetadata dbMetadata)
    throws MetaMappingExpansionException {
  MetaMappingExpander expander = new MetaMappingExpander(ppMapping.getTripleMaps());
  final ImmutableList<SQLPPTriplesMap> expandedMappingAxioms;
  if (expander.hasMappingsToBeExpanded()) {
    try (Connection connection = LocalJDBCConnectionUtils.createConnection(settings)) {
      expandedMappingAxioms = expander.getExpandedMappings(connection, dbMetadata);
    }
    // Problem while creating the connection
    catch (SQLException e) {
      throw new MetaMappingExpansionException(e.getMessage());
    }
  }
  else
    expandedMappingAxioms = expander.getNonExpandableMappings();
  try {
    return new SQLPPMappingImpl(expandedMappingAxioms, ppMapping.getMetadata());
  }
  catch (DuplicateMappingException e) {
    // Internal bug
    throw new IllegalStateException(e);
  }
}
origin: ontop/ontop

protected SQLPPMapping expandPPMapping(SQLPPMapping ppMapping, OntopMappingSQLSettings settings, RDBMetadata dbMetadata)
    throws MetaMappingExpansionException {
  MetaMappingExpander expander = new MetaMappingExpander(ppMapping.getTripleMaps(), termFactory,
      substitutionFactory);
  final ImmutableList<SQLPPTriplesMap> expandedMappingAxioms;
  if (expander.hasMappingsToBeExpanded()) {
    try (Connection connection = LocalJDBCConnectionUtils.createConnection(settings)) {
      expandedMappingAxioms = expander.getExpandedMappings(connection, dbMetadata);
    }
    // Problem while creating the connection
    catch (SQLException e) {
      throw new MetaMappingExpansionException(e.getMessage());
    }
  }
  else
    expandedMappingAxioms = expander.getNonExpandableMappings();
  try {
    return new SQLPPMappingImpl(expandedMappingAxioms, ppMapping.getMetadata());
  }
  catch (DuplicateMappingException e) {
    // Internal bug
    throw new IllegalStateException(e);
  }
}
it.unibz.inf.ontop.utilsLocalJDBCConnectionUtils

Most used methods

  • createConnection
    Brings robustness to some Tomcat classloading issues.

Popular in Java

  • Reactive rest calls using spring rest template
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
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