List of usage examples for java.sql SQLException getMessage
public String getMessage()
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void listActiveResets() { try {// w ww. j a va2 s.c o m Assert.assertNotNull(dao.listActiveResets()); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void verifySmsForReset() { try {/*from w w w . j a v a 2 s. c om*/ Assert.assertTrue(dao.verifySmsForReset(UserSecurityInformationDAOImplTest.GUID, resetId, smsCode)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void removeUserData() { try {/* w w w .j a v a2s .c om*/ Assert.assertTrue(dao.removeUserData(UserSecurityInformationDAOImplTest.GUID, null)); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void addOrUpdateSalt() { try {/*from w w w . j a v a 2 s . c o m*/ Assert.assertTrue( dao.addOrUpdateSalt(UserSecurityInformationDAOImplTest.GUID, logonSalt, 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 getResetData() { try {/* w w w .j a v a2 s . co m*/ Assert.assertNotNull( dao.getResetData("EgSEz9uTDeaCKvekHLB0PbKT9uzNj7vxm6yo8JklXnXRwNSUicI9ikx6dhpP1iGv")); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:com.cws.esolutions.security.dao.reference.impl.UserSecurityInformationDAOImplTest.java
@Test public void removeResetData() { try {/* w w w .j a v a 2 s . c o m*/ Assert.assertTrue(dao.removeResetData(UserSecurityInformationDAOImplTest.GUID, "EgSEz9uTDeaCKvekHLB0PbKT9uzNj7vxm6yo8JklXnXRwNSUicI9ikx6dhpP1iGv")); } catch (SQLException sqx) { Assert.fail(sqx.getMessage()); } }
From source file:jp.primecloud.auto.tool.management.zabbix.ZabbixSqlService.java
public void updateUsergroup(String username, int enableFlag) throws SQLException, Exception { //status 0:enable 1:disable String updateUsergroup = "update usrgrp SET users_status =" + enableFlag + " where name ='" + username + "'"; try {//from w ww. j ava2 s .c om sqlExecuter.execute(updateUsergroup); } catch (SQLException e) { log.error(e.getMessage(), e); throw new SQLException(e); } catch (Exception e) { log.error(e.getMessage(), e); throw new Exception(e); } }
From source file:eagle.storage.jdbc.criteria.TestTorque.java
public void testSelect() throws TorqueException, SQLException { Criteria crit = new Criteria(); crit.setDbName("eagle"); crit.addSelectColumn(new ColumnImpl("column1")); crit.addSelectColumn(new ColumnImpl("column2")); crit.addSelectColumn(new ColumnImpl("column2/100")); crit.where(new ColumnImpl("column1"), SqlEnum.GREATER_EQUAL); crit.addFrom("tableName"); crit.addAlias("column1", "c1"); crit.addGroupByColumn(new ColumnImpl("column1")); crit.addAscendingOrderByColumn(new ColumnImpl("column3")); crit.setLimit(1000);//from w w w .j a v a2 s . c om Query query = SqlBuilder.buildQuery(crit); String sql = query.toString(); System.out.println(sql); Connection connection = Torque.getConnection(); PreparedStatement statement = connection.prepareStatement(sql); statement.setInt(1, 1000); try { ResultSet result = statement.executeQuery(); } catch (SQLException ex) { LOG.warn(ex.getMessage(), ex); } finally { connection.close(); } }
From source file:com.espertech.esper.epl.db.DatabaseDSFactoryConnFactory.java
public Connection getConnection() throws DatabaseConfigException { Connection connection;/* w ww.j a v a 2s .c om*/ try { connection = dataSource.getConnection(); } catch (SQLException ex) { String detail = "SQLException: " + ex.getMessage() + " SQLState: " + ex.getSQLState() + " VendorError: " + ex.getErrorCode(); throw new DatabaseConfigException( "Error obtaining database connection using datasource " + "with detail " + detail, ex); } DatabaseDMConnFactory.setConnectionOptions(connection, connectionSettings); return connection; }
From source file:alpine.persistence.PersistenceInitializer.java
/** * Starts the H2 database engine if the database mode is set to 'server' *//*from ww w .ja va2 s .c o m*/ private void startDbServer() { final String mode = Config.getInstance().getProperty(Config.AlpineKey.DATABASE_MODE); final int port = Config.getInstance().getPropertyAsInt(Config.AlpineKey.DATABASE_PORT); if (StringUtils.isEmpty(mode) || !("server".equals(mode) || "embedded".equals(mode) || "external".equals(mode))) { LOGGER.error("Database mode not specified. Expected values are 'server', 'embedded', or 'external'"); } if (dbServer != null || "embedded".equals(mode) || "external".equals(mode)) { return; } final String[] args = new String[] { "-tcp", "-tcpPort", String.valueOf(port), "-tcpAllowOthers", }; try { LOGGER.info("Attempting to start database service"); dbServer = Server.createTcpServer(args).start(); LOGGER.info("Database service started"); } catch (SQLException e) { LOGGER.error("Unable to start database service: " + e.getMessage()); stopDbServer(); } }