本文整理汇总了Java中java.sql.Statement.isClosed方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.isClosed方法的具体用法?Java Statement.isClosed怎么用?Java Statement.isClosed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.Statement
的用法示例。
在下文中一共展示了Statement.isClosed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeStatement
import java.sql.Statement; //导入方法依赖的package包/类
/**
* Closes JDBC statement and open ResultSet without throwing exception. If there is one it is just logged.
*/
public static void closeStatement(
Statement statement ) {
if (statement == null) {
return;
}
try {
boolean isClosed;
try {
isClosed = statement.isClosed();
} catch (AbstractMethodError err) {
isClosed = false; // no JavaSE 6-compatible driver
}
if (statement != null && !isClosed) {
statement.close();
}
} catch (SQLException e) {
log.error(getFullSqlException("Could not close SQL statement", e));
}
}
示例2: closeStatement
import java.sql.Statement; //导入方法依赖的package包/类
public static void closeStatement(Statement stmt){
try{
if(stmt != null && !stmt.isClosed()){
stmt.close();
}
}catch(Exception e){
//
}
}
示例3: closeStatement
import java.sql.Statement; //导入方法依赖的package包/类
public void closeStatement ( final Statement statement )
{
try
{
if ( statement == null || statement.isClosed () )
{
return;
}
statement.close ();
}
catch ( final SQLException e )
{
logger.debug ( "Exception on closing statement", e );
}
}
示例4: createTables
import java.sql.Statement; //导入方法依赖的package包/类
public void createTables() throws IOException, SQLException {
URL resource = Resources.getResource(SkyWarsReloaded.class, "/tables.sql");
String[] databaseStructure = Resources.toString(resource, Charsets.UTF_8).split(";");
if (databaseStructure.length == 0) {
return;
}
Statement statement = null;
try {
connection.setAutoCommit(false);
statement = connection.createStatement();
for (String query : databaseStructure) {
query = query.trim();
if (query.isEmpty()) {
continue;
}
statement.execute(query);
}
connection.commit();
} finally {
connection.setAutoCommit(true);
if (statement != null && !statement.isClosed()) {
statement.close();
}
}
}