public final class JdbcUtils extends Object
限定符和类型 | 字段和说明 |
---|---|
static String |
DB2 |
static String |
DERBY |
static String |
H2 |
static String |
HBASE |
static String |
HIVE |
static String |
HSQL |
static String |
MOCK |
static String |
MYSQL |
static String |
ORACLE |
static String |
POSTGRESQL |
static String |
SQL_SERVER |
static String |
SYBASE |
构造器和说明 |
---|
JdbcUtils() |
限定符和类型 | 方法和说明 |
---|---|
static void |
close(Closeable x) |
static void |
close(Connection x) |
static void |
close(ResultSet x) |
static void |
close(Statement x) |
static Driver |
createDriver(String driverClassName) |
static void |
execute(Connection conn,
String sql,
List<Object> parameters) |
static void |
execute(DataSource dataSource,
String sql,
List<Object> parameters) |
static void |
execute(DataSource dataSource,
String sql,
Object... parameters) |
static List<Map<String,Object>> |
executeQuery(Connection conn,
String sql,
List<Object> parameters) |
static List<Map<String,Object>> |
executeQuery(DataSource dataSource,
String sql,
List<Object> parameters) |
static List<Map<String,Object>> |
executeQuery(DataSource dataSource,
String sql,
Object... parameters) |
static int |
executeUpdate(Connection conn,
String sql,
List<Object> parameters) |
static int |
executeUpdate(DataSource dataSource,
String sql,
List<Object> parameters) |
static int |
executeUpdate(DataSource dataSource,
String sql,
Object... parameters) |
static String |
getDbType(String rawUrl,
String driverClassName) |
static String |
getDriverClassName(String rawUrl) |
static String |
getTypeName(int sqlType) |
static void |
insertToTable(Connection conn,
String tableName,
Map<String,Object> data) |
static void |
insertToTable(DataSource dataSource,
String tableName,
Map<String,Object> data) |
static Class<?> |
loadDriverClass(String className) |
static String |
makeInsertToTableSql(String tableName,
Collection<String> names) |
static void |
printResultSet(ResultSet rs) |
static void |
printResultSet(ResultSet rs,
PrintStream out) |
public static final void close(Connection x)
public static final void close(Statement x)
public static final void close(ResultSet x)
public static final void close(Closeable x)
public static final void printResultSet(ResultSet rs) throws SQLException
SQLException
public static final void printResultSet(ResultSet rs, PrintStream out) throws SQLException
SQLException
public static String getTypeName(int sqlType)
public static String getDriverClassName(String rawUrl) throws SQLException
SQLException
public static Driver createDriver(String driverClassName) throws SQLException
SQLException
public static int executeUpdate(DataSource dataSource, String sql, Object... parameters) throws SQLException
SQLException
public static int executeUpdate(DataSource dataSource, String sql, List<Object> parameters) throws SQLException
SQLException
public static int executeUpdate(Connection conn, String sql, List<Object> parameters) throws SQLException
SQLException
public static void execute(DataSource dataSource, String sql, Object... parameters) throws SQLException
SQLException
public static void execute(DataSource dataSource, String sql, List<Object> parameters) throws SQLException
SQLException
public static void execute(Connection conn, String sql, List<Object> parameters) throws SQLException
SQLException
public static List<Map<String,Object>> executeQuery(DataSource dataSource, String sql, Object... parameters) throws SQLException
SQLException
public static List<Map<String,Object>> executeQuery(DataSource dataSource, String sql, List<Object> parameters) throws SQLException
SQLException
public static List<Map<String,Object>> executeQuery(Connection conn, String sql, List<Object> parameters) throws SQLException
SQLException
public static void insertToTable(DataSource dataSource, String tableName, Map<String,Object> data) throws SQLException
SQLException
public static void insertToTable(Connection conn, String tableName, Map<String,Object> data) throws SQLException
SQLException
public static String makeInsertToTableSql(String tableName, Collection<String> names)
Copyright © 2012 Alibaba Group. All Rights Reserved.