本文整理汇总了Java中java.sql.DatabaseMetaData.supportsBatchUpdates方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMetaData.supportsBatchUpdates方法的具体用法?Java DatabaseMetaData.supportsBatchUpdates怎么用?Java DatabaseMetaData.supportsBatchUpdates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.DatabaseMetaData
的用法示例。
在下文中一共展示了DatabaseMetaData.supportsBatchUpdates方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supportsBatchUpdates
import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
/**
* Return whether the given JDBC driver supports JDBC 2.0 batch updates.
* <p>Typically invoked right before execution of a given set of statements:
* to decide whether the set of SQL statements should be executed through
* the JDBC 2.0 batch mechanism or simply in a traditional one-by-one fashion.
* <p>Logs a warning if the "supportsBatchUpdates" methods throws an exception
* and simply returns {@code false} in that case.
* @param con the Connection to check
* @return whether JDBC 2.0 batch updates are supported
* @see java.sql.DatabaseMetaData#supportsBatchUpdates()
*/
public static boolean supportsBatchUpdates(Connection con) {
try {
DatabaseMetaData dbmd = con.getMetaData();
if (dbmd != null) {
if (dbmd.supportsBatchUpdates()) {
logger.debug("JDBC driver supports batch updates");
return true;
}
else {
logger.debug("JDBC driver does not support batch updates");
}
}
}
catch (SQLException ex) {
logger.debug("JDBC driver 'supportsBatchUpdates' method threw exception", ex);
}
catch (AbstractMethodError err) {
logger.debug("JDBC driver does not support JDBC 2.0 'supportsBatchUpdates' method", err);
}
return false;
}
示例2: supportsBatchUpdates
import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public static boolean supportsBatchUpdates(Connection conn) throws Exception {
DatabaseMetaData dbmd = conn.getMetaData();
if (dbmd != null) {
if (dbmd.supportsBatchUpdates()) {
return true;
}
}
return false;
}