Example usage for java.sql SQLException getMessage

List of usage examples for java.sql SQLException getMessage

Introduction

In this page you can find the example usage for java.sql SQLException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.mmone.hsqldb.Database.java

public Database(String dbPath) {
    this.dbParh = dbPath;
    try {//from  ww w  .j  a  v a 2s  . c  o  m
        setup();
    } catch (SQLException ex) {
        System.out.println("Error - " + ex.getMessage());
        Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.jfree.chart.demo.JDBCPieChartDemo.java

private PieDataset readData() {
    JDBCPieDataset jdbcpiedataset = null;
    String s = "jdbc:postgresql://nomad/jfreechartdb";
    try {//from   w w  w .ja  v  a2 s. c  o  m
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException classnotfoundexception) {
        System.err.print("ClassNotFoundException: ");
        System.err.println(classnotfoundexception.getMessage());
    }
    try {
        Connection connection = DriverManager.getConnection(s, "jfreechart", "password");
        jdbcpiedataset = new JDBCPieDataset(connection);
        String s1 = "SELECT * FROM PIEDATA1;";
        jdbcpiedataset.executeQuery(s1);
        connection.close();
    } catch (SQLException sqlexception) {
        System.err.print("SQLException: ");
        System.err.println(sqlexception.getMessage());
    } catch (Exception exception) {
        System.err.print("Exception: ");
        System.err.println(exception.getMessage());
    }
    return jdbcpiedataset;
}

From source file:edu.berkeley.ground.db.PostgresResults.java

public String getString(int index) throws GroundException {
    try {//from ww w.ja  v  a  2 s . c om
        return resultSet.getString(index);
    } catch (SQLException e) {
        LOGGER.error(e.getMessage());

        throw new GroundException(e);
    }
}

From source file:edu.berkeley.ground.db.PostgresResults.java

public int getInt(int index) throws GroundException {
    try {/*from w  w w . ja  v a2 s  .  co m*/
        return resultSet.getInt(index);
    } catch (SQLException e) {
        LOGGER.error(e.getMessage());

        throw new GroundException(e);
    }
}

From source file:edu.berkeley.ground.db.PostgresResults.java

public boolean getBoolean(int index) throws GroundException {
    try {//w w w.  jav  a2  s.  c  o  m
        return resultSet.getBoolean(index);
    } catch (SQLException e) {
        LOGGER.error(e.getMessage());

        throw new GroundException(e);
    }
}

From source file:com.cws.esolutions.security.dao.audit.impl.AuditDAOImplTest.java

@Test
public void auditRequestedOperation() {
    for (int x = 0; x < 50; x++) {
        List<String> auditList = new ArrayList<String>(Arrays.asList(RandomStringUtils.randomAlphanumeric(32),
                "junit", "f42fb0ba-4d1e-1126-986f-800cd2650000", "6236B840-88B0-4230-BCBC-8EC33EE837D9",
                "eSolutions-" + x, AuditType.JUNIT.name(), "junit", "junit"));

        try {/*from   w ww  .  j  a va 2s  .  c o  m*/

            auditDAO.auditRequestedOperation(auditList);
        } catch (SQLException sqx) {
            Assert.fail(sqx.getMessage());
        }
    }
}

From source file:edu.berkeley.ground.db.PostgresResults.java

public List<String> getStringList(int index) throws GroundException {
    try {//ww w .ja v a 2 s .  co m
        List<String> stringList = new ArrayList<>();
        do {
            stringList.add(this.getString(index));
        } while (resultSet.next());

        return stringList;
    } catch (SQLException e) {
        LOGGER.error(e.getMessage());

        throw new GroundException(e);
    }
}

From source file:it.unibas.spicy.persistence.idgenerator.utils.ExportDB.java

private Connection getConnectionToDatabase(String driver, String uri, String login, String pass)
        throws ClassNotFoundException, SQLException {
    Connection connection = null;
    try {/* w w  w  . j a  v a  2 s . c o m*/
        Class.forName(driver);
        connection = DriverManager.getConnection(uri, login, pass);
    } catch (SQLException e) {
        System.err.println(e.getMessage());
        System.exit(-1);
    }
    return connection;
}

From source file:org.jfree.chart.demo.JDBCCategoryChartDemo.java

private CategoryDataset readData() {
    JDBCCategoryDataset jdbccategorydataset = null;
    String s = "jdbc:postgresql://localhost/jfreechartdb";
    try {/* w  w  w.  java 2s .c  om*/
        Class.forName("org.postgresql.Driver");
    } catch (ClassNotFoundException classnotfoundexception) {
        System.err.print("ClassNotFoundException: ");
        System.err.println(classnotfoundexception.getMessage());
    }
    try {
        Connection connection = DriverManager.getConnection(s, "jfreechart", "password");
        jdbccategorydataset = new JDBCCategoryDataset(connection);
        String s1 = "SELECT * FROM CATEGORYDATA1;";
        System.out.println("Once...");
        jdbccategorydataset.executeQuery(s1);
        System.out.println("Again...");
        jdbccategorydataset.executeQuery(s1);
        System.out.println("Done.");
        connection.close();
    } catch (SQLException sqlexception) {
        System.err.print("SQLException: ");
        System.err.println(sqlexception.getMessage());
    } catch (Exception exception) {
        System.err.print("Exception: ");
        System.err.println(exception.getMessage());
    }
    return jdbccategorydataset;
}

From source file:jp.primecloud.auto.tool.management.db.DBConnector.java

public void closeConnection(Connection con, Statement stmt, ResultSet rs) throws SQLException {
    if (rs != null) {
        try {//from   w  ww .  j a va2s .  co  m
            rs.close();
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
        }
    }
    if (stmt != null) {
        try {
            stmt.close();
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
        }
    }
    if (con != null) {
        try {
            con.close();
        } catch (SQLException e) {
            log.error(e.getMessage(), e);
        }
    }
}