Example usage for java.sql Connection getWarnings

List of usage examples for java.sql Connection getWarnings

Introduction

In this page you can find the example usage for java.sql Connection getWarnings.

Prototype

SQLWarning getWarnings() throws SQLException;

Source Link

Document

Retrieves the first warning reported by calls on this Connection object.

Usage

From source file:rems.Global.java

public static void executeGnrlSQL(String genSql) {
    Statement stmt = null;/*from  w  ww.  j  a  va 2  s .  co m*/
    try {
        Connection mycon = null;
        Class.forName("org.postgresql.Driver");
        mycon = DriverManager.getConnection(Global.connStr, Global.Uname, Global.Pswd);
        mycon.setAutoCommit(false);
        //System.out.println("Opened database successfully");

        stmt = mycon.createStatement();
        stmt.executeUpdate(genSql);
        mycon.commit();
        Global.updateLogMsg(Global.logMsgID,
                "\r\n" + stmt.getWarnings().toString() + ": " + mycon.getWarnings().toString() + "\r\n",
                Global.logTbl, Global.gnrlDateStr, Global.rnUser_ID);
        stmt.close();
        mycon.close();
    } catch (Exception ex) {
        Global.errorLog = genSql + "\r\n" + ex.getMessage();
        Global.writeToLog();
    } finally {

    }
}