public void runUserQuery(final String userString,final int userInput)
抛出IllegalArgumentException,NamingException{
系统出来println(“正在执行”+userString+“”+userInput);
类NewDao扩展了JdbcDaoSupport{
public NewDao() throws IllegalArgumentException, NamingException {
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
bean.setJndiName("<JNDI Name>");
bean.afterPropertiesSet();
DataSource dataSource = (DataSource) bean.getObject();
setDataSource(dataSource);
}
public void executeQueryMultiple() {
int index = userInput;
while (index > 0) {
this.getJdbcTemplate().execute(userString);
index ;
}
}
}
;
NewDao dao = new NewDao();
dao.executeQueryMultiple();
}
# 1 楼答案
这在很大程度上取决于您使用的数据库。但这里有一个例子for Oracle。通常,您需要一个
Connection
、一个Statement
和一个ResultSet
# 2 楼答案
这就是我想要的答案/代码:
public void runUserQuery(final String userString,final int userInput) 抛出IllegalArgumentException,NamingException{ 系统出来println(“正在执行”+userString+“”+userInput); 类NewDao扩展了JdbcDaoSupport{
不幸的是,我没能让你们理解,结果投了反对票D