public final class DBUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanup(Class<? extends Driver> driverClass)
Performs any Database related cleanup
|
static void |
deregisterAllDrivers(Class<? extends Driver> driverClass)
De-register all SQL drivers that are associated with the class
|
static DriverCleanup |
ensureJDBCDriverIsAvailable(Class<? extends Driver> jdbcDriverClass,
String connectionString,
String jdbcPluginType,
String jdbcPluginName)
Ensures that the JDBC Driver specified in configuration is available and can be loaded.
|
static List<co.cask.cdap.api.data.schema.Schema.Field> |
getSchemaFields(ResultSet resultSet)
Given the result set, get the metadata of the result set and return
list of
Schema.Field,
where name of the field is same as column name and type of the field is obtained using getType(int) |
public static void cleanup(Class<? extends Driver> driverClass)
driverClass - the JDBC driver classpublic static DriverCleanup ensureJDBCDriverIsAvailable(Class<? extends Driver> jdbcDriverClass, String connectionString, String jdbcPluginType, String jdbcPluginName) throws IllegalAccessException, InstantiationException, SQLException
DriverManager if it is not already registered.public static List<co.cask.cdap.api.data.schema.Schema.Field> getSchemaFields(ResultSet resultSet) throws SQLException
Schema.Field,
where name of the field is same as column name and type of the field is obtained using getType(int)resultSet - result set of executed querySQLExceptionpublic static void deregisterAllDrivers(Class<? extends Driver> driverClass) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.