List of usage examples for java.sql SQLException toString
public String toString()
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetgetBoolean() { try {//from w w w . j a v a 2 s.co m Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.absolute(1)); Assert.assertEquals(Boolean.parseBoolean("42"), BQScrollableResultSetFunctionTest.Result.getBoolean(2)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetgetFloat() { try {/* www.j a va 2s. com*/ Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.absolute(1)); Assert.assertEquals(new Float(42), BQScrollableResultSetFunctionTest.Result.getFloat(2)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetgetInteger() { try {//w w w . ja v a2s .co m Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.absolute(1)); Assert.assertEquals(42, BQScrollableResultSetFunctionTest.Result.getInt(2)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetLast() { try {/* ww w. j av a2s . c o m*/ Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.last()); Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.isLast()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetgetString() { try {/*from w w w . jav a 2 s. c o m*/ Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.first()); Assert.assertEquals("you", BQScrollableResultSetFunctionTest.Result.getString(1)); Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.last()); Assert.assertEquals("word", BQScrollableResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetgetRow() { try {// w w w . ja va2s .c o m Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.absolute(1)); Assert.assertEquals(1, BQScrollableResultSetFunctionTest.Result.getRow()); Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.absolute(10)); Assert.assertEquals(10, BQScrollableResultSetFunctionTest.Result.getRow()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } try { BQScrollableResultSetFunctionTest.Result.beforeFirst(); Assert.assertEquals(0, BQScrollableResultSetFunctionTest.Result.getRow()); BQScrollableResultSetFunctionTest.Result.afterLast(); Assert.assertEquals(0, BQScrollableResultSetFunctionTest.Result.getRow()); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } }
From source file:com.viettel.logistic.wms.dao.StockTransDAO.java
public ResultDTO updateSynTransCode(String stockTransId, String synTransCode, Connection connection) { ResultDTO result = new ResultDTO(); StringBuilder sql = new StringBuilder(); ///*from www.j a v a 2s . c o m*/ String message = ParamUtils.SUCCESS; String key = stockTransId; sql.append(" UPDATE stock_trans SET syn_trans_code = ? where stock_trans_id = ? "); try { PreparedStatement stm = connection.prepareStatement(sql.toString()); stm.setString(1, (String) DataUtil.nvl(synTransCode)); stm.setString(2, (String) DataUtil.nvl(stockTransId)); int num = stm.executeUpdate(); } catch (SQLException ex) { System.out.println(ex.toString()); Logger.getLogger(StockTransDAO.class.getName()).log(Level.SEVERE, null, ex); message = ParamUtils.FAIL; key = ParamUtils.SYSTEM_OR_DATA_ERROR; } result.setKey(key); result.setMessage(message); return result; // }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetAfterlast() { try {/*from w w w.jav a2s .co m*/ BQScrollableResultSetFunctionTest.Result.afterLast(); Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.previous()); Assert.assertEquals("word", BQScrollableResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } try { BQScrollableResultSetFunctionTest.Result.afterLast(); Assert.assertEquals("", BQScrollableResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { boolean ct = e.toString().contains("Cursor is not in a valid Position"); if (ct == true) { Assert.assertTrue(ct); } else { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } } }
From source file:BQJDBC.QueryResultTest.BQScrollableResultSetFunctionTest.java
@Test public void TestResultSetBeforeFirst() { try {/*from www.jav a 2 s . co m*/ BQScrollableResultSetFunctionTest.Result.beforeFirst(); Assert.assertTrue(BQScrollableResultSetFunctionTest.Result.next()); Assert.assertEquals("you", BQScrollableResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } try { BQScrollableResultSetFunctionTest.Result.beforeFirst(); Assert.assertEquals("", BQScrollableResultSetFunctionTest.Result.getString(1)); } catch (SQLException e) { boolean ct = e.toString().contains("Cursor is not in a valid Position"); if (ct == true) { Assert.assertTrue(ct); } else { this.logger.error("SQLexception" + e.toString()); Assert.fail("SQLException" + e.toString()); } } }