List of usage examples for java.sql ResultSet getBigDecimal
BigDecimal getBigDecimal(String columnLabel) throws SQLException;
ResultSet
object as a java.math.BigDecimal
with full precision. From source file:org.kawanfw.test.api.client.InsertAndUpdatePrepStatementTest.java
/** * Test that the values were correclty inserted * /*from w w w . java 2 s.c om*/ * @param connection */ @SuppressWarnings("deprecation") public void selectPrepStatementTest(Connection connection, int customerId, int orderId) throws Exception { int customer_id; int item_id; String description; BigDecimal cost_price; BigDecimal cost_price_scale; Date date_placed; Timestamp date_shipped; byte[] jpeg_image = null; boolean is_delivered; int quantity; String sql = "select * from orderlog where customer_id = ? and item_id = ? "; PreparedStatement prepStatement = connection.prepareStatement(sql); int i = 1; prepStatement.setInt(i++, customerId); prepStatement.setInt(i++, orderId); ResultSet rs = prepStatement.executeQuery(); MessageDisplayer.display(""); SqlUtil sqlUtil = new SqlUtil(connection); while (rs.next()) { customer_id = rs.getInt("customer_id"); item_id = rs.getInt("item_id"); description = rs.getString("description"); cost_price = rs.getBigDecimal("cost_price"); cost_price_scale = rs.getBigDecimal("cost_price", 5); date_placed = rs.getDate("date_placed"); date_shipped = rs.getTimestamp("date_shipped"); jpeg_image = rs.getBytes("jpeg_image"); if (sqlUtil.isIngres()) { is_delivered = (rs.getInt("is_delivered") == 1) ? true : false; } else { is_delivered = rs.getBoolean("is_delivered"); } quantity = rs.getInt("quantity"); MessageDisplayer.display("customer_id : " + customer_id); MessageDisplayer.display("item_id : " + item_id); MessageDisplayer.display("description : " + description); MessageDisplayer.display("cost_price : " + cost_price); MessageDisplayer.display("cost_price_scale: " + cost_price_scale); MessageDisplayer.display("date_placed : " + date_placed); MessageDisplayer.display("date_shipped : " + date_shipped); MessageDisplayer.display("jpeg_image : " + jpeg_image); MessageDisplayer.display("is_delivered : " + is_delivered); MessageDisplayer.display("quantity : " + quantity); // Assert done on first 18 chars (ex: 2011-11-02 16:26:14), because // MySql Truncs // the remaining milliseconds Assert.assertEquals(dateShippedUpdated.toString().substring(0, 19), date_shipped.toString().substring(0, 19)); if (new SqlUtil(connection).isSQLAnywhere()) { // Because SQLK Anywhere stores 5000.0000 instead of 5000 in db Assert.assertEquals(new BigDecimal(customer_id * increaseFactor).toString(), cost_price.toString().substring(0, 4)); } else { Assert.assertEquals(new BigDecimal(customer_id * increaseFactor).toString(), cost_price.toString()); } Assert.assertEquals(true, is_delivered); Assert.assertEquals(customer_id * increaseFactor * 2, quantity); i = 1; customer_id = rs.getInt(i++); item_id = rs.getInt(i++); description = rs.getString(i++); int iForCostPrice = i; cost_price = rs.getBigDecimal(i++); cost_price_scale = rs.getBigDecimal(iForCostPrice, 5); date_placed = rs.getDate(i++); date_shipped = rs.getTimestamp(i++); // NO! do not read twice the same file ==> has been delete at first // read // jpeg_image = rs.getBytes(i++); i++; is_delivered = rs.getBoolean(i++); quantity = rs.getInt(i++); MessageDisplayer.display(""); MessageDisplayer.display("customer_id : " + customer_id); MessageDisplayer.display("item_id : " + item_id); MessageDisplayer.display("description : " + description); MessageDisplayer.display("cost_price : " + cost_price); MessageDisplayer.display("cost_price_scale: " + cost_price_scale); MessageDisplayer.display("date_placed : " + date_placed); MessageDisplayer.display("date_shipped : " + date_shipped); MessageDisplayer.display("jpeg_image : " + jpeg_image); MessageDisplayer.display("is_delivered : " + is_delivered); MessageDisplayer.display("quantity : " + quantity); // Assert done on first 18 chars (ex: 2011-11-02 16:26:14), because // MySql Truncs // the remaining milliseconds Assert.assertEquals(date_shipped.toString().substring(0, 18), dateShippedUpdated.toString().substring(0, 18)); if (new SqlUtil(connection).isSQLAnywhere()) { // Because SQLK Anywhere stores 5000.0000 instead of 5000 in db Assert.assertEquals(new BigDecimal(customer_id * increaseFactor).toString(), cost_price.toString().substring(0, 4)); } else { Assert.assertEquals(new BigDecimal(customer_id * increaseFactor).toString(), cost_price.toString()); } Assert.assertEquals(true, is_delivered); Assert.assertEquals(new Integer(customer_id * increaseFactor * 2), new Integer(quantity)); } prepStatement.close(); rs.close(); MessageDisplayer.display("Select done!"); }
From source file:com.norconex.collector.http.data.store.impl.jdbc.JDBCCrawlDataSerializer.java
@Override public ICrawlData toCrawlData(String table, ResultSet rs) throws SQLException { if (rs == null) { return null; }/*from ww w.j ava2 s .co m*/ HttpCrawlData data = new HttpCrawlData(); data.setReference(rs.getString("reference")); data.setParentRootReference(rs.getString("parentRootReference")); data.setRootParentReference(rs.getBoolean("isRootParentReference")); data.setState(HttpCrawlState.valueOf(rs.getString("state"))); data.setMetaChecksum(rs.getString("metaChecksum")); data.setDocumentChecksum(rs.getString("contentChecksum")); data.setDepth(rs.getInt("depth")); BigDecimal bigLM = rs.getBigDecimal("sitemapLastMod"); if (bigLM != null) { data.setSitemapLastMod(bigLM.longValue()); } BigDecimal bigP = rs.getBigDecimal("sitemapPriority"); if (bigP != null) { data.setSitemapPriority(bigP.floatValue()); } data.setSitemapChangeFreq(rs.getString("sitemapChangeFreq")); data.setReferrerReference(rs.getString("referrerReference")); data.setReferrerLinkTag(rs.getString("referrerLinkTag")); data.setReferrerLinkText(rs.getString("referrerLinkText")); data.setReferrerLinkTitle(rs.getString("referrerLinkTitle")); return data; }
From source file:it.jnrpe.plugin.CCheckOracle.java
/** * Checks database usage//from w w w . ja va 2 s. com * @param c * @param cl * @return */ private CReturnValue checkTablespace(Connection c, CCommandLine cl) { // Integer iWarning = new Integer(cl.getOptionValue("warning", "70")); // Integer iCritical = new Integer(cl.getOptionValue("critical", "80")); String sWarning = cl.getOptionValue("warning", "70"); String sCritical = cl.getOptionValue("critical", "80"); String sTablespace = cl.getOptionValue("tablespace").toUpperCase(); String sQry = "select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc" + " from (" + " select tablespace_name,sum(bytes)/1024/1024 total" + " from dba_data_files group by tablespace_name) A" + " LEFT OUTER JOIN" + " ( select tablespace_name,sum(bytes)/1024/1024 free" + " from dba_free_space group by tablespace_name) B" + " ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='" + sTablespace + "'"; Statement stmt = null; ResultSet rs = null; try { stmt = c.createStatement(); rs = stmt.executeQuery(sQry); boolean bFound = rs.next(); if (!bFound) return new CReturnValue(IJNRPEConstants.STATE_UNKNOWN, "CHECK_ORACLE : UNKNOWN - Tablespace " + cl.getOptionValue("tablespace") + " do not exist?"); BigDecimal ts_free = rs.getBigDecimal(1); BigDecimal ts_total = rs.getBigDecimal(2); BigDecimal ts_pct = rs.getBigDecimal(3); String sMsg = "{0} : {1} {2} - {3,number,0.#}% used [ {4,number,0.#} / {5,number,0.#} MB available ]|{1}={3,number,0.#}%;{6};{7};0;100"; Object[] vObjs = new Object[8]; vObjs[0] = cl.getOptionValue("db"); vObjs[1] = cl.getOptionValue("tablespace"); vObjs[2] = "OK"; vObjs[3] = ts_pct; vObjs[4] = ts_free; vObjs[5] = ts_total; vObjs[6] = sWarning; vObjs[7] = sCritical; MessageFormat mf = new MessageFormat(sMsg); //if (ts_pct.compareTo(new BigDecimal(iCritical.intValue())) == 1) if (ThresholdUtil.isValueInRange(sCritical, ts_pct)) { vObjs[2] = "CRITICAL"; CReturnValue rv = new CReturnValue(IJNRPEConstants.STATE_CRITICAL, mf.format(vObjs)); return rv; } if (ThresholdUtil.isValueInRange(sWarning, ts_pct)) { vObjs[2] = "WARNING"; CReturnValue rv = new CReturnValue(IJNRPEConstants.STATE_WARNING, mf.format(vObjs)); return rv; } CReturnValue rv = new CReturnValue(IJNRPEConstants.STATE_OK, mf.format(vObjs)); return rv; } catch (Exception e) { return new CReturnValue(IJNRPEConstants.STATE_CRITICAL, "CHECK_ORACLE : CRITICAL - " + e.getMessage()); } finally { try { stmt.close(); rs.close(); } catch (Exception e) { } } }
From source file:org.mayocat.shop.billing.store.jdbi.mapper.AbstractOrderMapper.java
protected void fillOrderSummary(ResultSet resultSet, OrderSummary order) throws SQLException { order.setId((UUID) resultSet.getObject("id")); order.setSlug(resultSet.getString("slug")); order.setBillingAddressId((UUID) resultSet.getObject("billing_address_id")); order.setDeliveryAddressId((UUID) resultSet.getObject("delivery_address_id")); order.setCustomerId((UUID) resultSet.getObject("customer_id")); order.setCreationDate(resultSet.getTimestamp("creation_date")); order.setUpdateDate(resultSet.getTimestamp("update_date")); order.setNumberOfItems(resultSet.getLong("number_of_items")); order.setCurrency(Currency.getInstance(resultSet.getString("currency"))); order.setItemsTotal(resultSet.getBigDecimal("items_total")); order.setItemsTotalExcl(resultSet.getBigDecimal("items_total_excl")); order.setShipping(resultSet.getBigDecimal("shipping")); order.setShippingExcl(resultSet.getBigDecimal("shipping_excl")); order.setGrandTotal(resultSet.getBigDecimal("grand_total")); order.setGrandTotalExcl(resultSet.getBigDecimal("grand_total_excl")); order.setStatus(OrderSummary.Status.valueOf(resultSet.getString("status"))); order.setAdditionalInformation(resultSet.getString("additional_information")); ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new GuavaModule()); try {//from w w w .j a va2 s .c o m Map<String, Object> data = mapper.readValue(resultSet.getString("order_data"), new TypeReference<Map<String, Object>>() { }); order.setOrderData(data); } catch (IOException e) { logger.error("Failed to deserialize order data", e); } }
From source file:org.springframework.jdbc.support.JdbcUtils.java
/** * Retrieve a JDBC column value from a ResultSet, using the specified value type. * <p>Uses the specifically typed ResultSet accessor methods, falling back to * {@link #getResultSetValue(java.sql.ResultSet, int)} for unknown types. * <p>Note that the returned value may not be assignable to the specified * required type, in case of an unknown type. Calling code needs to deal * with this case appropriately, e.g. throwing a corresponding exception. * @param rs is the ResultSet holding the data * @param index is the column index/* w w w. ja v a2 s .c om*/ * @param requiredType the required value type (may be {@code null}) * @return the value object (possibly not of the specified required type, * with further conversion steps necessary) * @throws SQLException if thrown by the JDBC API * @see #getResultSetValue(ResultSet, int) */ @Nullable public static Object getResultSetValue(ResultSet rs, int index, @Nullable Class<?> requiredType) throws SQLException { if (requiredType == null) { return getResultSetValue(rs, index); } Object value; // Explicitly extract typed value, as far as possible. if (String.class == requiredType) { return rs.getString(index); } else if (boolean.class == requiredType || Boolean.class == requiredType) { value = rs.getBoolean(index); } else if (byte.class == requiredType || Byte.class == requiredType) { value = rs.getByte(index); } else if (short.class == requiredType || Short.class == requiredType) { value = rs.getShort(index); } else if (int.class == requiredType || Integer.class == requiredType) { value = rs.getInt(index); } else if (long.class == requiredType || Long.class == requiredType) { value = rs.getLong(index); } else if (float.class == requiredType || Float.class == requiredType) { value = rs.getFloat(index); } else if (double.class == requiredType || Double.class == requiredType || Number.class == requiredType) { value = rs.getDouble(index); } else if (BigDecimal.class == requiredType) { return rs.getBigDecimal(index); } else if (java.sql.Date.class == requiredType) { return rs.getDate(index); } else if (java.sql.Time.class == requiredType) { return rs.getTime(index); } else if (java.sql.Timestamp.class == requiredType || java.util.Date.class == requiredType) { return rs.getTimestamp(index); } else if (byte[].class == requiredType) { return rs.getBytes(index); } else if (Blob.class == requiredType) { return rs.getBlob(index); } else if (Clob.class == requiredType) { return rs.getClob(index); } else if (requiredType.isEnum()) { // Enums can either be represented through a String or an enum index value: // leave enum type conversion up to the caller (e.g. a ConversionService) // but make sure that we return nothing other than a String or an Integer. Object obj = rs.getObject(index); if (obj instanceof String) { return obj; } else if (obj instanceof Number) { // Defensively convert any Number to an Integer (as needed by our // ConversionService's IntegerToEnumConverterFactory) for use as index return NumberUtils.convertNumberToTargetClass((Number) obj, Integer.class); } else { // e.g. on Postgres: getObject returns a PGObject but we need a String return rs.getString(index); } } else { // Some unknown type desired -> rely on getObject. try { return rs.getObject(index, requiredType); } catch (AbstractMethodError err) { logger.debug("JDBC driver does not implement JDBC 4.1 'getObject(int, Class)' method", err); } catch (SQLFeatureNotSupportedException ex) { logger.debug("JDBC driver does not support JDBC 4.1 'getObject(int, Class)' method", ex); } catch (SQLException ex) { logger.debug("JDBC driver has limited support for JDBC 4.1 'getObject(int, Class)' method", ex); } // Corresponding SQL types for JSR-310 / Joda-Time types, left up // to the caller to convert them (e.g. through a ConversionService). String typeName = requiredType.getSimpleName(); if ("LocalDate".equals(typeName)) { return rs.getDate(index); } else if ("LocalTime".equals(typeName)) { return rs.getTime(index); } else if ("LocalDateTime".equals(typeName)) { return rs.getTimestamp(index); } // Fall back to getObject without type specification, again // left up to the caller to convert the value if necessary. return getResultSetValue(rs, index); } // Perform was-null check if necessary (for results that the JDBC driver returns as primitives). return (rs.wasNull() ? null : value); }
From source file:com.norconex.collector.http.db.impl.derby.DerbyCrawlURLDatabase.java
private CrawlURL toCrawlURL(ResultSet rs) throws SQLException { if (rs == null) { return null; }/* ww w . java2 s . c o m*/ int colCount = rs.getMetaData().getColumnCount(); CrawlURL crawlURL = new CrawlURL(rs.getString("url"), rs.getInt("depth")); if (colCount > COLCOUNT_SITEMAP) { crawlURL.setSitemapChangeFreq(rs.getString("smChangeFreq")); BigDecimal bigP = rs.getBigDecimal("smPriority"); if (bigP != null) { crawlURL.setSitemapPriority(bigP.floatValue()); } BigDecimal bigLM = rs.getBigDecimal("smLastMod"); if (bigLM != null) { crawlURL.setSitemapLastMod(bigLM.longValue()); } if (colCount > COLCOUNT_ALL) { crawlURL.setDocChecksum(rs.getString("docchecksum")); crawlURL.setHeadChecksum(rs.getString("headchecksum")); crawlURL.setStatus(CrawlStatus.valueOf(rs.getString("status"))); } } return crawlURL; }
From source file:pl.psnc.synat.wrdz.realm.db.WrdzUserDatabaseHandler.java
/** * Authenticates user using username and password he provided and comparing it to the data in the user database. * /*from ww w . j a v a 2 s . c o m*/ * @param username * name of the user who is to be authenticated. * @param password * password of the user who is to be authenticated. * @return whether or not user data is valid (passed user data matches data in the database). */ public boolean isUserValid(String username, char[] password) { Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; boolean valid = false; byte[] salt = null; try { connection = getConnection(); statement = connection.prepareStatement(saltQuery); statement.setString(1, username); resultSet = statement.executeQuery(); if (resultSet.next()) { BigDecimal decimalSalt = resultSet.getBigDecimal(1); if (decimalSalt != null) { salt = decimalSalt.toBigIntegerExact().toByteArray(); } } } catch (SQLException ex) { logger.log(Level.SEVERE, "Cannot validate user " + username + ", exception: " + ex.toString()); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Cannot validate user", ex); } } catch (Exception ex) { logger.log(Level.SEVERE, "Invalid user " + username); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Cannot validate user", ex); } } finally { close(connection, statement, resultSet); } try { char[] hashedPassword = digestAuthHandler.hashPassword(password, salt); connection = getConnection(); statement = connection.prepareStatement(passwordQuery); statement.setString(1, username); resultSet = statement.executeQuery(); if (resultSet.next()) { Reader reader = resultSet.getCharacterStream(1); char[] retrievedPassword = extractFromReader(reader); valid = digestAuthHandler.comparePasswords(hashedPassword, retrievedPassword); } } catch (SQLException ex) { logger.log(Level.SEVERE, "Cannot validate user " + username + ", exception: " + ex.toString()); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Cannot validate user", ex); } } catch (Exception ex) { logger.log(Level.SEVERE, "Invalid user " + username); if (logger.isLoggable(Level.FINE)) { logger.log(Level.FINE, "Cannot validate user", ex); } } finally { close(connection, statement, resultSet); } return valid; }
From source file:org.pasta.apps.form.InvoiceReturn.java
public Vector<Vector<Object>> getData(int orgId, String invoiceFrom, String invoiceTo, java.util.Date invoiceDateFrom, java.util.Date invoiceDateTo, int invoiceDocType, int customerId, String invoiceSent) {//from w w w . j a v a 2 s .com Vector<Vector<Object>> dataL = new Vector<Vector<Object>>(); List<Object> params = new ArrayList<Object>(); StringBuffer sql = new StringBuffer( "SELECT iv.IsSent , iv.DocumentNo , bp.Name as CustomerName , iv.DateInvoiced , iv.GrandTotal , iv.InvoiceStatusNote , iv.C_Invoice_ID\n"); sql.append("FROM C_Invoice iv INNER JOIN C_BPartner bp ON iv.C_BPartner_ID = bp.C_BPartner_ID ").append( "WHERE iv.IsSOTrx = 'Y' AND iv.DocStatus ='CO' AND iv.AD_Client_ID = ? AND iv.AD_Org_Id = ? \n"); params.add(Env.getAD_Client_ID(getCtx())); params.add(orgId); if (!StringUtils.isEmpty(invoiceFrom)) { sql.append("AND iv.DocumentNo >= ? "); params.add(invoiceFrom); } if (!StringUtils.isEmpty(invoiceTo)) { sql.append("AND iv.DocumentNo <= ? "); params.add(invoiceTo); } if (invoiceDateFrom != null) { sql.append("AND iv.DateInvoiced >= ? "); java.sql.Date dateFrom = new java.sql.Date(invoiceDateFrom.getTime()); params.add(dateFrom); } if (invoiceDateTo != null) { sql.append("AND iv.DateInvoiced <= ? "); java.sql.Date dateTo = new java.sql.Date(invoiceDateTo.getTime()); params.add(dateTo); } if (invoiceDocType > 0) { sql.append("AND iv.C_DocType_ID = ? "); params.add(invoiceDocType); } if (customerId > 0) { sql.append("AND iv.C_BPartner_ID = ? "); params.add(customerId); } if (!StringUtils.isEmpty(invoiceSent)) { sql.append("AND COALESCE(iv.IsSent,'N') = ? "); params.add(invoiceSent); } sql.append("ORDER BY iv.DocumentNo Desc , iv.DateInvoiced "); PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null); try { int prmIdx = 1; for (Object param : params) { pstmt.setObject(prmIdx++, param); } ResultSet rs = pstmt.executeQuery(); while (rs.next()) { ids.put(rs.getString("DocumentNo"), rs.getInt("C_Invoice_ID")); Vector<Object> line = new Vector<Object>(7); line.add(new Boolean(false)); KeyNamePair pp = new KeyNamePair(rs.getInt("C_Invoice_ID"), rs.getString("DocumentNo")); line.add(pp); line.add(rs.getString("CustomerName")); line.add(rs.getTimestamp("DateInvoiced")); line.add(rs.getBigDecimal("GrandTotal")); line.add(StringUtils.defaultIfEmpty(rs.getString("InvoiceStatusNote"), "")); line.add(new Boolean("Y".equals(rs.getString("IsSent")))); dataL.add(line); } rs.close(); pstmt.close(); } catch (Exception ex) { log.log(Level.SEVERE, sql.toString(), ex); } return dataL; }
From source file:com.google.enterprise.connector.salesforce.storetype.DBStore.java
public DocListEntry getDocsImmediatelyAfter(String checkpoint) { DatabaseMetaData dbm = null;//w w w . j a v a 2 s .c om Connection connection = null; try { connection = ds.getConnection(); connection.setAutoCommit(true); dbm = connection.getMetaData(); //get the most recent database row after 'checkpoint' if (dbm.getDatabaseProductName().equals("MySQL")) { Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); String update_stmt = "select crawl_set,insert_timestamp,UNCOMPRESS(crawl_data) as cdata from " + this.instance_table + " where crawl_set>" + checkpoint + " LIMIT 1"; logger.log(Level.FINER, update_stmt); ResultSet rs = statement.executeQuery(update_stmt); boolean ret_rows = rs.first(); if (!ret_rows) { logger.log(Level.FINER, "No Rows Returned."); connection.close(); return null; } BigDecimal crawl_set = null; String crawl_data = null; while (ret_rows) { crawl_set = rs.getBigDecimal("crawl_set"); //crawl_data = rs.getString("crawl_data"); crawl_data = rs.getString("cdata"); ret_rows = rs.next(); } rs.close(); statement.close(); connection.close(); //BASE64 DECODE byte[] byte_decoded_entry = org.apache.commons.codec.binary.Base64 .decodeBase64(crawl_data.getBytes()); crawl_data = new String(byte_decoded_entry); logger.log(Level.INFO, "Returning from DBStore. Index Value: " + crawl_set.toPlainString()); logger.log(Level.FINEST, "Returning from DBStore. " + crawl_data); DocListEntry dret = new DocListEntry(crawl_set.toPlainString(), crawl_data); return dret; } } catch (Exception ex) { logger.log(Level.SEVERE, "Unable to retrieve docListEntry " + ex); } return new DocListEntry(checkpoint, null); }
From source file:nl.tudelft.stocktrader.mysql.MySQLCustomerDAO.java
public Account getCustomerByUserId(String userId) throws DAOException { PreparedStatement getCustomerByUserId = null; try {// w w w . j a v a 2 s . c om getCustomerByUserId = sqlConnection.prepareStatement(SQL_SELECT_GET_CUSTOMER_BY_USERID); getCustomerByUserId.setString(1, userId); ResultSet rs = getCustomerByUserId.executeQuery(); if (rs.next()) { try { Account bean = new Account(rs.getInt(1), rs.getString(2), StockTraderUtility.convertToCalendar(rs.getDate(3)), rs.getBigDecimal(4), rs.getInt(5), rs.getBigDecimal(6), StockTraderUtility.convertToCalendar(rs.getDate(7)), rs.getInt(8)); return bean; } finally { try { rs.close(); } catch (SQLException e) { logger.debug("", e); } } } } catch (SQLException e) { throw new DAOException("", e); } finally { if (getCustomerByUserId != null) { try { getCustomerByUserId.close(); } catch (SQLException e) { logger.debug("", e); } } } return null; }