public final class DBUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CONNECTION_ARGUMENTS |
static String |
OVERRIDE_SCHEMA |
| 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<io.cdap.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
DBUtils#getSchema(int, int, int) |
static List<io.cdap.cdap.api.data.schema.Schema.Field> |
getSchemaFields(ResultSet resultSet,
String schemaStr)
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
DBUtils#getSchema(int, int, int) |
static Object |
transformValue(int sqlType,
int precision,
int scale,
ResultSet resultSet,
String fieldName) |
public static final String OVERRIDE_SCHEMA
public static final String CONNECTION_ARGUMENTS
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<io.cdap.cdap.api.data.schema.Schema.Field> getSchemaFields(ResultSet resultSet, @Nullable String schemaStr) throws SQLException
Schema.Field,
where name of the field is same as column name and type of the field is obtained using
DBUtils#getSchema(int, int, int)resultSet - result set of executed queryschemaStr - schema string to override resultant schemaSQLExceptionIOExceptionpublic static List<io.cdap.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
DBUtils#getSchema(int, int, int)resultSet - result set of executed querySQLException@Nullable public static Object transformValue(int sqlType, int precision, int scale, ResultSet resultSet, String fieldName) throws SQLException
SQLExceptionpublic static void deregisterAllDrivers(Class<? extends Driver> driverClass) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException
Copyright © 2019 CDAP Licensed under the Apache License, Version 2.0.