0

발생 N-번 호출 작동 : 같은 SP가 오류없이 작동 있기 때문에, 이상하다,SimpleJdbcCall은의 StoredProcedure가 나는 다음 오류했습니다 오류

[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 [[email protected]] 
[http-thread-pool-8080(5)] DEBUG o.s.j.support.SQLErrorCodesFactory - Database product name cached for DataSource [[email protected]]: 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 

을하지만,하지만, N-번 호출 될 때를 던졌습니다 오류. Glassfish 3.1.2를 통해 풀링 된 연결로 Spring을 사용하고 있습니다. Sqlserver 2005 데이터베이스로 이동합니다. 스레드간에 콩 - 여기

그것은 당신이 당신의 "삽입"을 공유하는 것을처럼 보이는 자바 기능

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

내 첫 번째 추측은 실수로 여러 스레드 내에서 jdbc 항목을 공유하고 있으며 동기화 문제라는 것입니다. 그게 가능하니? – mbelow

+0

약 10 개의 다른 연결 풀을 가졌습니다. SP를 호출 한 후 응용 프로그램은 jdbcTemplate을 통해 select를 실행하고 작동합니다. 그런 다음 거래를 등록해야하며 SP를 사용합니다. –

답변

0

입니다. 삽입 빈에서 scope = "prototype"을 사용하여 각 호출에 대해 새 인스턴스를 가져 오도록하십시오.

+0

문제가 여전히 생존하고 있다고 생각합니다. 연결에 문제가 있다고 생각합니다. –

+0

스프링 구성의 관련 부분을 게시 할 수 있습니까? 공유해서는 안되는 스레드간에 공유하고 있다고 생각합니다. – mbelow