List of usage examples for java.sql SQLException getMessage
public String getMessage()
From source file:org.dspace.versioning.DefaultItemVersionProvider.java
public void deleteVersionedItem(Context c, Version versionToDelete, VersionHistory history) { try {//from w ww . ja v a2 s. co m // if versionToDelete is the current version we have to reinstate the previous version // and reset canonical if (versionHistoryService.isLastVersion(history, versionToDelete) && history.getVersions().size() > 1) { // reset the previous version to archived Item item = versionHistoryService.getPrevious(history, versionToDelete).getItem(); item.setInArchive(true); itemService.update(c, item); } // assign tombstone to the Identifier and reset canonical to the previous version only if there is a previous version Item itemToDelete = versionToDelete.getItem(); identifierService.delete(c, itemToDelete); } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } catch (AuthorizeException e) { throw new RuntimeException(e.getMessage(), e); } catch (IdentifierException e) { throw new RuntimeException(e.getMessage(), e); } }
From source file:br.com.great.dao.IrLocaisDAO.java
/** * Metodo responsavel por retornar todos os dados de uma entidade irlocias * @param mecanica_id id da mecanica// w w w .j ava2s. co m * @return JSONObjet objeto com todos os dados da entidade irlocais */ public IrLocal getMecIrLocais(int mecanica_id) { PreparedStatement pstmt = null; ResultSet rs = null; Connection conexao = criarConexao(); IrLocal irLocais = null; try { String sql = "SELECT * FROM `irlocais` WHERE `irlocais`.`mecanica_id` = " + mecanica_id; pstmt = conexao.prepareStatement(sql); rs = pstmt.executeQuery(); if (rs.next()) { irLocais = new IrLocal(); irLocais.setIrlocal_id(rs.getInt("id")); irLocais.setPosicao(new Posicao(rs.getDouble("latitude"), rs.getDouble("longitude"))); irLocais.setMecsimples_id(rs.getInt("mecanica_id")); } } catch (SQLException e) { System.out.println("Erro ao listar todos os clientes: " + e.getMessage()); } finally { fecharConexao(conexao, pstmt, rs); } return irLocais; }
From source file:com.espertech.esperio.db.core.DMLStatement.java
public void execute(Connection connection, EventBean eventBean) { PreparedStatement statement = null; try {/*from w w w . j av a2s. com*/ if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug("Executing '" + dmlSQL + ")"); } statement = connection.prepareStatement(dmlSQL); for (Map.Entry<Integer, BindingEntry> entry : bindings.entrySet()) { Object value = entry.getValue().getGetter().get(eventBean); statement.setObject(entry.getKey(), value); } int rows = statement.executeUpdate(); if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug("Execution yielded " + rows + " rows"); } } catch (SQLException ex) { String message = "Failed to invoke : " + dmlSQL + " :" + ex.getMessage(); log.error(message, ex); storeExceptionHandler.handle(message, ex); throw new StoreExceptionDBRel(message, ex); } finally { try { if (statement != null) statement.close(); } catch (SQLException e) { } } }
From source file:com.teradata.benchto.driver.macro.query.QueryMacroExecutionDriver.java
private void setSessionForPresto(Connection connection, String sqlStatement) { PrestoConnection prestoConnection;//from w w w . j a va 2s . co m try { prestoConnection = connection.unwrap(PrestoConnection.class); } catch (SQLException e) { LOGGER.error(e.getMessage()); throw new UnsupportedOperationException( format("SET SESSION for non PrestoConnection [%s] is not supported", connection.getClass())); } String[] keyValue = extractKeyValue(sqlStatement); prestoConnection.setSessionProperty(keyValue[0].trim(), keyValue[1].trim()); }
From source file:com.cws.esolutions.core.dao.impl.ServerDataDAOImplTest.java
@Test public void getInstalledServer() { try {/*from ww w. j a v a 2s . c o m*/ Assert.assertNotNull(dao.getServer("DMGRSERVER")); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.core.dao.impl.ServerDataDAOImplTest.java
@Test public void getInstalledServers() { try {/*from ww w . j av a 2s . c om*/ Assert.assertNotNull(dao.listServers(0)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.core.dao.impl.ServerDataDAOImplTest.java
@Test public void getServersByAttribute() { try {/*from w w w . j a v a 2 s . co m*/ Assert.assertNotNull(dao.getServersByAttribute("DMGRSERVER DEV", 0)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.core.dao.impl.ServerDataDAOImplTest.java
@Test public void removeExistingServer() { try {//from www . j a va 2s .c om Assert.assertNotNull(dao.removeServer(this.guid)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void getUserSalt() { try {/*from ww w .j a va2 s .c o m*/ Assert.assertNotNull(dao.getUserSalt(UserSecurityInformationDAOImplTest.GUID, SaltType.LOGON.name())); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void insertResetData() { try {/*from www . j a v a 2 s . c om*/ Assert.assertTrue(dao.insertResetData(UserSecurityInformationDAOImplTest.GUID, resetId, null)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }