⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sqlexceptionhandler.java

📁 一个用java写的地震分析软件(无源码)-used to write a seismic analysis software (without source)
💻 JAVA
字号:
package org.trinet.jdbc;
import java.lang.*;
import java.sql.*;
/** Class to assist handling of JDBC SQLException */
public class SQLExceptionHandler {
/** Performs Connection.rollback() and prints the SQLException chain in detail. */
    public static void handleException(SQLException ex, Connection sqlCon) {
	try {
	    if (sqlCon != null) sqlCon.rollback();
	} catch (SQLException ex2) {}
	prtSQLException(ex);
    }
    
/** Prints the details of a SQLException chain.
* Writes ex.SQLState(), ex.getMessage(), ex.getErrorCode(), plus printStackTrace(ex)
*/
    public static void prtSQLException( SQLException ex) {
	System.err.println ("\n ----SQLexception caught---- \n");
	while (ex != null) {
	    System.err.println( "SQLstate: " + ex.getSQLState() );
	    System.err.println( "Message: " + ex.getMessage() );
	    System.err.println( "Vendor code: " + ex.getErrorCode() );
	    ex.printStackTrace(System.err);
	    ex = ex.getNextException();
	    System.err.println("");
	}
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -