Java Examples for org.springframework.jdbc.UncategorizedSQLException
The following java examples will help you to understand the usage of org.springframework.jdbc.UncategorizedSQLException. These source code samples are taken from different open source projects.
Example 1
Project: spring-framework-2.5.x-master File: DataSourceTransactionManagerTests.java View source code |
protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(dsToUse));
assertTrue("Synchronization active", TransactionSynchronizationManager.isSynchronizationActive());
assertTrue("Is new transaction", status.isNewTransaction());
assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
Connection tCon = DataSourceUtils.getConnection(dsToUse);
try {
if (createStatement) {
tCon.createStatement();
assertEquals(con, new SimpleNativeJdbcExtractor().getNativeConnection(tCon));
}
} catch (SQLException ex) {
throw new UncategorizedSQLException("", "", ex);
}
}
Example 2
Project: buendia-master File: SyncBehaviorTest.java View source code |
@Test
@NotTransactional
public void shouldNotCreateASyncRecordWhenTheTransactionIsRolledBack() throws Exception {
ConceptService cs = Context.getConceptService();
SyncService ss = Context.getService(SyncService.class);
int initialSyncRecordCount = ss.getSyncRecords().size();
boolean exceptionThrown = false;
try {
ConceptClass cc = cs.getConceptClass(1);
cc.setUuid("An invalid long uuid that for sure should result into an exception");
cs.saveConceptClass(cc);
} catch (UncategorizedSQLException e) {
exceptionThrown = true;
}
assertTrue(exceptionThrown);
//No sync record should have been created
assertEquals(initialSyncRecordCount, ss.getSyncRecords().size());
}
Example 3
Project: hq-master File: TimingListenerWrapper.java View source code |
public void processEvents(List events) { long time, start = System.currentTimeMillis(); try { _target.processEvents(events); } catch (UncategorizedSQLException ex) { log.debug("UncategorizedSQLException caught.", ex); } finally { time = System.currentTimeMillis() - start; if (time > _maxTime) { _maxTime = time; } _totTime += time; _numEvents += events.size(); } }
Example 4
Project: egovframework.rte.root-master File: ComplexPropertiesMapperTest.java View source code |
@Test
public void testComplexPropertiesHierarcyRepetitionSelect() throws Exception {
EmpVO vo = new EmpVO();
// 7369,'SMITH','CLERK',7902
// --> 7902,'FORD','ANALYST',7566
// --> 7566,'JONES','MANAGER',7839
// --> 7839,'KING','PRESIDENT',NULL
vo.setEmpNo(new BigDecimal(7369));
try {
// select
// EmpIncludesMgrVO resultVO =
// empDAO.selectEmpMgrHierarchy("selectEmpWithMgr",
// vo);
EmpIncludesMgrVO resultVO = empGeneralMapper.selectEmpMgrHierarchy("selectMgrHierarchy", vo);
// check
assertNotNull(resultVO);
assertEquals(new BigDecimal(7369), resultVO.getEmpNo());
assertEquals("SMITH", resultVO.getEmpName());
assertEquals("CLERK", resultVO.getJob());
assertEquals(new BigDecimal(7902), resultVO.getMgr());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault());
assertEquals(sdf.parse("1980-12-17"), resultVO.getHireDate());
assertEquals(new BigDecimal(800), resultVO.getSal());
//assertEquals(new BigDecimal(0), resultVO.getComm()); -->NULL을 리턴하여 주석처리함.
assertEquals(new BigDecimal(20), resultVO.getDeptNo());
assertTrue(resultVO.getMgrVO() instanceof EmpIncludesMgrVO);
assertEquals(new BigDecimal(7902), resultVO.getMgrVO().getEmpNo());
assertEquals(new BigDecimal(7566), resultVO.getMgrVO().getMgrVO().getEmpNo());
assertEquals(new BigDecimal(7839), resultVO.getMgrVO().getMgrVO().getMgrVO().getEmpNo());
assertNull(resultVO.getMgrVO().getMgrVO().getMgrVO().getMgrVO());
} catch (UncategorizedSQLException ue) {
ue.printStackTrace();
System.out.println("=====ue.getCause()======" + ue.getCause());
}
}
Example 5
Project: symmetric-ds-master File: InterbaseSymmetricDialect.java View source code |
@Override
public void createRequiredDatabaseObjects() {
String contextTableName = parameterService.getTablePrefix() + "_" + CONTEXT_TABLE_NAME;
try {
platform.getSqlTemplate().queryForInt("select count(*) from " + contextTableName);
} catch (Exception e) {
try {
log.info("Creating global temporary table {}", contextTableName);
platform.getSqlTemplate().update(String.format(CONTEXT_TABLE_CREATE, contextTableName));
} catch (Exception ex) {
log.error("Error while initializing Interbase dialect", ex);
}
}
String escape = this.parameterService.getTablePrefix() + "_" + "escape";
if (!installed(SQL_FUNCTION_INSTALLED, escape)) {
String sql = "declare external function $(functionName) cstring(32660) " + " returns cstring(32660) free_it entry_point 'sym_escape' module_name 'sym_udf' ";
install(sql, escape);
}
String hex = this.parameterService.getTablePrefix() + "_" + "hex";
if (!installed(SQL_FUNCTION_INSTALLED, hex)) {
String sql = "declare external function $(functionName) blob " + " returns cstring(32660) free_it entry_point 'sym_hex' module_name 'sym_udf' ";
install(sql, hex);
}
String rtrim = this.parameterService.getTablePrefix() + "_" + "rtrim";
if (!installed(SQL_FUNCTION_INSTALLED, rtrim)) {
String sql = "declare external function $(functionName) cstring(32767) " + " returns cstring(32767) free_it entry_point 'IB_UDF_rtrim' module_name 'ib_udf' ";
install(sql, rtrim);
}
try {
platform.getSqlTemplate().queryForObject("select sym_escape('') from rdb$database", String.class);
} catch (UncategorizedSQLException e) {
if (e.getSQLException().getErrorCode() == -804) {
log.error("Please install the sym_udf.so/dll to your {interbase_home}/UDF folder");
}
throw new RuntimeException("Function SYM_ESCAPE is not installed", e);
}
}
Example 6
Project: easyrec-code-master File: DBRootDAOTest.java View source code |
@Test
public void testCreateDatabaseExistingNoOverwriteNoCheck() {
try {
assertFalse(rootDAO.existsDatabase(DB_NAME));
rootDAO.createDatabase(DB_NAME);
assertTrue(rootDAO.existsDatabase(DB_NAME));
rootDAO.createDatabase(DB_NAME, false, false);
fail();
} catch (UncategorizedSQLException use) {
} finally {
rootDAO.deleteDatabase(DB_NAME);
}
}
Example 7
Project: spring-batch-master File: HibernateFailureJobFunctionalTests.java View source code |
@Test
public void testLaunchJob() throws Exception {
validatePreConditions();
JobParameters params = new JobParametersBuilder().addString("key", "failureJob").toJobParameters();
writer.setFailOnFlush(2);
try {
jobLauncherTestUtils.launchJob(params);
} catch (HibernateJdbcException e) {
throw e;
} catch (UncategorizedSQLException e) {
throw e;
}
int after = jdbcTemplate.queryForObject("SELECT COUNT(*) from CUSTOMER", Integer.class);
assertEquals(4, after);
validatePostConditions();
}
Example 8
Project: CoursesPortlet-master File: DegreeProgressController.java View source code |
@RequestMapping(params = "action=showWhatIf")
public ModelAndView showWhatIfProgress(PortletRequest request, @ModelAttribute("whatIfForm") WhatIfRequest whatIfRequest) {
Map<String, Object> model = new HashMap<String, Object>();
String err;
try {
DegreeProgressReport report = degreeProgressDao.getWhatIfReport(whatIfRequest);
model.put("report", report);
DegreeProgramSummary summary = new DegreeProgramSummary();
List<ProgramComponent> programs = degreeProgramDao.getPrograms(whatIfRequest.getEntryTerm());
for (ProgramComponent program : programs) {
if (program.getKey().equals(whatIfRequest.getProgram())) {
summary.setProgram(program.getName());
break;
}
}
List<ProgramComponent> majors = degreeProgramDao.getMajors(whatIfRequest.getProgram());
for (ProgramComponent major : majors) {
if (major.getKey().equals(whatIfRequest.getMajor())) {
summary.getMajors().add(major);
break;
}
}
if (StringUtils.isNotBlank(whatIfRequest.getMajor2())) {
for (ProgramComponent major : majors) {
if (major.getKey().equals(whatIfRequest.getMajor2())) {
summary.getMajors().add(major);
break;
}
}
}
List<ProgramComponent> minors = degreeProgramDao.getMinors();
if (StringUtils.isNotBlank(whatIfRequest.getMinor())) {
for (ProgramComponent minor : minors) {
if (minor.getKey().equals(whatIfRequest.getMinor())) {
summary.getMinors().add(minor);
break;
}
}
}
if (StringUtils.isNotBlank(whatIfRequest.getMinor2())) {
for (ProgramComponent minor : minors) {
if (minor.getKey().equals(whatIfRequest.getMinor2())) {
summary.getMinors().add(minor);
break;
}
}
}
List<ProgramComponent> concentrations = degreeProgramDao.getConcentrations();
if (StringUtils.isNotBlank(whatIfRequest.getConcentration())) {
for (ProgramComponent concentration : concentrations) {
if (concentration.getKey().equals(whatIfRequest.getConcentration())) {
summary.getConcentrations().add(concentration);
break;
}
}
}
if (StringUtils.isNotBlank(whatIfRequest.getConcentration2())) {
for (ProgramComponent concentration : concentrations) {
if (concentration.getKey().equals(whatIfRequest.getConcentration2())) {
summary.getConcentrations().add(concentration);
break;
}
}
}
model.put("program", summary);
return new ModelAndView("degreeProgress", model);
} catch (EmptyResultDataAccessException e) {
System.out.print(e);
err = "Your Banner record is not complete at this time please try again later.";
model.put("err", err);
return new ModelAndView("error", model);
} catch (UncategorizedSQLException e) {
System.out.print(e);
err = "You are not a student and cannot run this portlet.";
model.put("err", err);
return new ModelAndView("error", model);
} catch (Exception e) {
System.out.print(e);
e.printStackTrace();
err = "General Error\nPlease check the log.";
model.put("err", err);
return new ModelAndView("error", model);
}
}
Example 9
Project: openmicroscopy-master File: SessionManagerImpl.java View source code |
/**
* Initialization method called by the Spring run-time to acquire an initial
* {@link Session}.
*/
public void init() {
try {
asroot = new Principal(internal_uuid, "system", "Sessions");
final Session session = executeInternalSession();
internalSession = new InternalSessionContext(session, roles);
cache.putSession(internal_uuid, internalSession);
} catch (UncategorizedSQLException uncat) {
log.warn("Assuming that this is read-only");
} catch (DataAccessException dataAccess) {
throw new RuntimeException(" " + "=====================================================\n" + "Data access exception: Did you create your database? \n" + "=====================================================\n", dataAccess);
}
}
Example 10
Project: camel-master File: SqlRouteTest.java View source code |
@Test
public void testBatchMissingParamAtEnd() throws Exception {
try {
List<?> data = Arrays.asList(Arrays.asList(9, "stu", "vwx"), Arrays.asList(10, "yza"));
template.sendBody("direct:batch", data);
fail();
} catch (RuntimeCamelException e) {
assertTrue(e.getCause() instanceof UncategorizedSQLException);
}
assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 9", Integer.class));
assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from projects where id = 10", Integer.class));
}
Example 11
Project: spring-framework-master File: DataSourceTransactionManagerTests.java View source code |
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(dsToUse));
assertTrue("Synchronization active", TransactionSynchronizationManager.isSynchronizationActive());
assertTrue("Is new transaction", status.isNewTransaction());
assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
Connection tCon = DataSourceUtils.getConnection(dsToUse);
try {
if (createStatement) {
tCon.createStatement();
}
} catch (SQLException ex) {
throw new UncategorizedSQLException("", "", ex);
}
}
Example 12
Project: effectivejava-master File: DataSourceTransactionManagerTests.java View source code |
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) throws RuntimeException {
assertTrue("Has thread connection", TransactionSynchronizationManager.hasResource(dsToUse));
assertTrue("Synchronization active", TransactionSynchronizationManager.isSynchronizationActive());
assertTrue("Is new transaction", status.isNewTransaction());
assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
assertTrue(TransactionSynchronizationManager.isActualTransactionActive());
Connection tCon = DataSourceUtils.getConnection(dsToUse);
try {
if (createStatement) {
tCon.createStatement();
assertEquals(con, new SimpleNativeJdbcExtractor().getNativeConnection(tCon));
}
} catch (SQLException ex) {
throw new UncategorizedSQLException("", "", ex);
}
}
Example 13
Project: egovframe.rte.3.5-master File: ComplexPropertiesMapperTest.java View source code |
@Test
public void testComplexPropertiesHierarcyRepetitionSelect() throws Exception {
EmpVO vo = new EmpVO();
// 7369,'SMITH','CLERK',7902
// --> 7902,'FORD','ANALYST',7566
// --> 7566,'JONES','MANAGER',7839
// --> 7839,'KING','PRESIDENT',NULL
vo.setEmpNo(new BigDecimal(7369));
try {
// select
// EmpIncludesMgrVO resultVO =
// empDAO.selectEmpMgrHierarchy("selectEmpWithMgr",
// vo);
EmpIncludesMgrVO resultVO = empGeneralMapper.selectEmpMgrHierarchy("selectMgrHierarchy", vo);
// check
assertNotNull(resultVO);
assertEquals(new BigDecimal(7369), resultVO.getEmpNo());
assertEquals("SMITH", resultVO.getEmpName());
assertEquals("CLERK", resultVO.getJob());
assertEquals(new BigDecimal(7902), resultVO.getMgr());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault());
assertEquals(sdf.parse("1980-12-17"), resultVO.getHireDate());
assertEquals(new BigDecimal(800), resultVO.getSal());
//assertEquals(new BigDecimal(0), resultVO.getComm()); -->NULL을 리턴하여 주석처리함.
assertEquals(new BigDecimal(20), resultVO.getDeptNo());
assertTrue(resultVO.getMgrVO() instanceof EmpIncludesMgrVO);
assertEquals(new BigDecimal(7902), resultVO.getMgrVO().getEmpNo());
assertEquals(new BigDecimal(7566), resultVO.getMgrVO().getMgrVO().getEmpNo());
assertEquals(new BigDecimal(7839), resultVO.getMgrVO().getMgrVO().getMgrVO().getEmpNo());
assertNull(resultVO.getMgrVO().getMgrVO().getMgrVO().getMgrVO());
} catch (UncategorizedSQLException ue) {
ue.printStackTrace();
System.out.println("=====ue.getCause()======" + ue.getCause());
}
}