org.springframework.jdbc.core.JdbcTemplate.setDatabaseProductName()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.springframework.jdbc.core.JdbcTemplate.setDatabaseProductName()方法的一些代码示例,展示了JdbcTemplate.setDatabaseProductName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTemplate.setDatabaseProductName()方法的具体详情如下:
包路径:org.springframework.jdbc.core.JdbcTemplate
类名称:JdbcTemplate
方法名:setDatabaseProductName

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);
}

相关文章