本文整理了Java中org.springframework.jdbc.core.JdbcTemplate.setDatabaseProductName()
方法的一些代码示例,展示了JdbcTemplate.setDatabaseProductName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTemplate.setDatabaseProductName()
方法的具体详情如下:
包路径:org.springframework.jdbc.core.JdbcTemplate
类名称:JdbcTemplate
方法名:setDatabaseProductName
暂无
代码示例来源:origin: spring-projects/spring-framework
@Test
public void testSQLErrorCodeTranslationWithSpecifiedDbName() throws Exception {
final SQLException sqlException = new SQLException("I have a known problem", "99999", 1054);
final String sql = "SELECT ID FROM CUSTOMER";
given(this.resultSet.next()).willReturn(true);
given(this.connection.createStatement()).willReturn(this.preparedStatement);
JdbcTemplate template = new JdbcTemplate();
template.setDataSource(this.dataSource);
template.setDatabaseProductName("MySQL");
template.afterPropertiesSet();
this.thrown.expect(BadSqlGrammarException.class);
this.thrown.expect(exceptionCause(sameInstance(sqlException)));
try {
template.query(sql, (RowCallbackHandler) rs -> {
throw sqlException;
});
}
finally {
verify(this.resultSet).close();
verify(this.preparedStatement).close();
verify(this.connection).close();
}
}
代码示例来源:origin: io.bufferslayer/bufferslayer-spring-jdbc
public void setDatabaseProductName(String dbName) {
delegate.setDatabaseProductName(dbName);
}
代码示例来源:origin: io.bufferslayer/buffer-spring-jdbc
public void setDatabaseProductName(String dbName) {
delegate.setDatabaseProductName(dbName);
}
内容来源于网络,如有侵权,请联系作者删除!