List of usage examples for java.sql SQLException getLocalizedMessage
public String getLocalizedMessage()
From source file:org.deegree.db.legacy.LegacyConnectionProvider.java
@Override public void init() { try {//from w w w. j a v a 2s .co m getConnection().close(); } catch (SQLException e) { throw new ResourceInitException(e.getLocalizedMessage(), e); } }
From source file:org.apache.kylin.rest.controller.QueryController.java
@RequestMapping(value = "/tables_and_columns", method = RequestMethod.GET, produces = { "application/json" }) @ResponseBody/*from w w w .j a va2 s .c om*/ public List<TableMeta> getMetadata(MetaRequest metaRequest) { try { return queryService.getMetadata(metaRequest.getProject()); } catch (SQLException e) { throw new InternalErrorException(e.getLocalizedMessage(), e); } }
From source file:ca.phon.ipadictionary.impl.DatabaseDictionary.java
@Override public void clear() throws IPADictionaryExecption { Connection conn = IPADatabaseManager.getInstance().getConnection(); if (conn != null) { String qSt = "DELETTE * FROM transcript WHERE langId = ?"; try {/*from www . j ava 2 s . c o m*/ PreparedStatement pSt = conn.prepareStatement(qSt); pSt.setString(1, getLanguage().toString()); pSt.executeUpdate(); } catch (SQLException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } }
From source file:ca.phon.ipadictionary.impl.DatabaseDictionary.java
@Override public void removeEntry(String ortho, String ipa) throws IPADictionaryExecption { Connection conn = IPADatabaseManager.getInstance().getConnection(); if (conn != null) { String qSt = "DELETE FROM transcript WHERE orthography = ?" + " AND ipa = ? AND langId = ?"; try {/*from ww w . jav a2s . co m*/ PreparedStatement pSt = conn.prepareStatement(qSt); pSt.setString(1, ortho); pSt.setString(2, ipa); pSt.setString(3, getLanguage().toString()); pSt.execute(); pSt.close(); } catch (SQLException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } }
From source file:org.dspace.ctask.demo.ExifExtractor.java
private void cleanup() { try {/*from w ww . j av a2 s . c om*/ c.complete(); } catch (SQLException e) { log.info("Couldn't obtain context: " + e.getLocalizedMessage()); } }
From source file:ca.phon.ipadictionary.impl.DatabaseDictionary.java
@Override public void addEntry(String ortho, String ipa) throws IPADictionaryExecption { Connection conn = IPADatabaseManager.getInstance().getConnection(); if (conn != null) { String qSt = "INSERT INTO transcript (langId, orthography, ipa) VALUES( ?, ?, ? )"; try {// w ww . j a v a 2 s . c o m checkLangId(conn); PreparedStatement pSt = conn.prepareStatement(qSt); pSt.setString(1, getLanguage().toString()); pSt.setString(2, ortho.toLowerCase()); pSt.setString(3, ipa); pSt.execute(); pSt.close(); } catch (SQLException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } }
From source file:ca.phon.ipadictionary.impl.DatabaseDictionary.java
@Override public String[] lookup(String ortho) throws IPADictionaryExecption { Connection conn = IPADatabaseManager.getInstance().getConnection(); List<String> retVal = new ArrayList<String>(); if (conn != null) { ortho = StringUtils.strip(ortho, "?!\"'.\\/@&$()^%#*"); String qSt = "SELECT * FROM transcript WHERE orthography = ? AND langId = ?"; try {//from w w w. ja v a 2 s .c o m PreparedStatement pSt = conn.prepareStatement(qSt); pSt.setString(1, ortho.toLowerCase()); pSt.setString(2, getLanguage().toString()); java.sql.ResultSet rs = pSt.executeQuery(); while (rs.next()) { retVal.add(rs.getString("IPA")); } rs.close(); pSt.close(); } catch (SQLException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); } } return retVal.toArray(new String[0]); }
From source file:eu.artofcoding.beetlejuice.spring.SpringContextHelper.java
private void closeDataSources() { Map<String, BasicDataSource> map2 = applicationContext.getBeansOfType(BasicDataSource.class); for (String key : map2.keySet()) { BasicDataSource dataSource = map2.get(key); try {/*from w w w .j a v a2 s . co m*/ dataSource.close(); } catch (SQLException e) { logger.error( String.format("Could not close dataSource %s: %s", dataSource, e.getLocalizedMessage()), e); } } }
From source file:org.cook_e.cook_e.BugReportActivity.java
/** * Uploads a report to the remote database * @param report the report to upload//from www . j a v a 2 s. c om */ private void uploadReport(BugReport report) { try { final SQLBugUploader uploader = new SQLBugUploader(); uploader.submitBug(report); finish(); } catch (SQLException e) { new AlertDialog.Builder(this).setTitle("Failed to send report").setMessage(e.getLocalizedMessage()) .show(); Log.w(TAG, "Failed to send bug report", e); } }
From source file:com.kylinolap.rest.controller.QueryController.java
@RequestMapping(value = "/tables_and_columns", method = RequestMethod.GET) @ResponseBody/*from w ww . j a v a 2 s . com*/ public List<TableMeta> getMetadata(MetaRequest metaRequest) { try { return queryService.getMetadata(metaRequest.getProject()); } catch (SQLException e) { logger.error(e.getLocalizedMessage(), e); throw new InternalErrorException(e.getLocalizedMessage(), e); } }