【发布时间】:2025-12-19 09:50:11
【问题描述】:
尝试使用 Spring JdbcTemplate 从 Java 访问 AS400/DB2 存储过程,
XmlBeanFactory beanFactory2 = new XmlBeanFactory(new ClassPathResource(
"datasource_as400.xml"));
DataSource ds2 = (DataSource) beanFactory2.getBean("dataSource");
jdbc2 = new JdbcTemplate(ds2);
jdbc2.update("{CALL TESTONE(?)}", new Object[] { new String("JOHN") });
我收到以下错误
[DEBUG,SQLErrorCodeSQLExceptionTranslator] Translating SQLException with SQL state '42704', error code '-204', message [[SQL0204] TESTONE in type *N not found.]; SQL was [{CALL TESTONE(?)}] for task [PreparedStatementCallback]
[FATAL,MainBatch] processDonations(): org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [{CALL TESTONE(?)}]; nested exception is java.sql.SQLException: [SQL0204] TESTONE in type *N not found.
【问题讨论】:
标签: java spring db2 jdbctemplate