我有下一个错误:
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.core.simple.SimpleJdbcCall - JdbcCall call not compiled before execution - invoking compile
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.datasource.DataSourceUtils - Registering transaction synchronization for JDBC Connection
[http-thread-pool-8080(5)] DEBUG o.s.j.c.m.CallMetaDataProviderFactory - Using org.springframework.jdbc.core.metadata.SqlServerCallMetaDataProvider
[http-thread-pool-8080(5)] DEBUG o.s.j.c.m.CallMetaDataProvider - Retrieving metadata for BATABASE/dbo/PA_INSERT
[http-thread-pool-8080(5)] WARN o.s.j.c.m.CallMetaDataProvider - Error while retrieving metadata for procedure columns: com.microsoft.sqlserver.jdbc.SQLServerException: Could not find prepared statement with handle 41.
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.core.simple.SimpleJdbcCall - Compiled stored procedure. Call string is [{call DATABASE.dbo.PA_INSERT()}]
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.core.simple.SimpleJdbcCall - SqlCall for procedure [PA_ISolicitudDistincion] compiled
[http-thread-pool-8080(5)] DEBUG o.s.j.c.m.CallMetaDataContext - Matching [COLUMN1, COLUMN2, COLUMN3] with []
[http-thread-pool-8080(5)] DEBUG o.s.j.c.m.CallMetaDataContext - Found match for []
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.core.simple.SimpleJdbcCall - The following parameters are used for call {call DATABASE.dbo.PA_INSERT()} with: {}
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.core.JdbcTemplate - Calling stored procedure [{call DATABASE.dbo.PA_INSERT()}]
[http-thread-pool-8080(5)] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
[http-thread-pool-8080(5)] INFO o.s.j.support.SQLErrorCodesFactory - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
[http-thread-pool-8080(5)] DEBUG o.s.j.support.SQLErrorCodesFactory - Looking up default SQLErrorCodes for DataSource [com.sun.gjc.spi.jdbc40.DataSource40@12ea240]
[http-thread-pool-8080(5)] DEBUG o.s.j.support.SQLErrorCodesFactory - Database product name cached for DataSource [com.sun.gjc.spi.jdbc40.DataSource40@12ea240]: name is 'Microsoft SQL Server'
[http-thread-pool-8080(5)] DEBUG o.s.j.support.SQLErrorCodesFactory - SQL error codes for 'Microsoft SQL Server' found
[http-thread-pool-8080(5)] DEBUG o.s.j.s.SQLErrorCodeSQLExceptionTranslator - Unable to translate SQLException with Error code '201', will now try the fallback translator
[http-thread-pool-8080(5)] DEBUG o.s.j.s.SQLStateSQLExceptionTranslator - Extracted SQL state class 'S0' from value 'S0004'
[http-thread-pool-8080(5)] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource
但是,这很奇怪,因为,同样的SP没有错误,但是当被调用N次时会抛出错误。 我使用Spring通过Glassfish 3.1.2进行池化连接。到Sqlserver 2005数据库。
这是java函数
public int registrar(Object1 p,
Object2 d)
{
try
{
final SimpleJdbcCall jdbcCall = (SimpleJdbcCall) context
.getBean("insert");
jdbcCall.setCatalogName("DATABASE");
jdbcCall.setSchemaName("dbo");
final MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("COLUMN1", p.get1());
params.addValue("COLUMN2", p.get1());
params.addValue("COLUMN3", d.get2());
final Map<String, Object> execute = jdbcCall.execute(params);
return (Integer) execute.get("IDENTITY");
}
catch (DataAccessException e)
{
return null;
}
}
答案 0 :(得分:0)
看起来你正在共享你的“插入” - bean之间的线程。尝试在insert bean上使用scope =“prototype”,这样就可以确保为每个调用获取一个新实例。