List of usage examples for org.springframework.jdbc BadSqlGrammarException printStackTrace
public void printStackTrace()
From source file:wiki.link.LinkResource.java
public static void insertAll(List<Link> links, DbConnector dbc) { BatchPreparedStatementSetter bpss = new BatchPreparedStatementSetter() { @Override//from ww w . j a v a 2s .c o m public void setValues(PreparedStatement preparedStatement, int i) throws SQLException { preparedStatement.setLong(1, links.get(i).from); preparedStatement.setLong(2, links.get(i).to); } @Override public int getBatchSize() { return links.size(); } }; try { dbc.jdbcTemplate.batchUpdate("INSERT INTO links(fromPage, toPage) values(?, ?)", bpss); } catch (BadSqlGrammarException e) { e.printStackTrace(); BatchUpdateException bue = (BatchUpdateException) e.getCause(); System.out.println(bue.getNextException()); System.exit(1); } }
From source file:org.owasp.proxy.http.dao.JdbcMessageDAO.java
public void createTables() throws DataAccessException { JdbcTemplate template = getJdbcTemplate(); try {//from w w w.java2s . c o m template.execute(CREATE_CONTENTS_TABLE); template.execute(CREATE_HEADERS_TABLE); template.execute(CREATE_REQUESTS_TABLE); template.execute(CREATE_RESPONSES_TABLE); template.execute(CREATE_CONVERSATIONS_TABLE); } catch (BadSqlGrammarException e) { e.printStackTrace(); // FIXME: get database metadata, and see if the tables already exist } }