at org.springframework.jdbc.datasource.DataSourceUtils.getConnection (DataSourceUtils.java: 82)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java: 381)
at org.springframework.jdbc.core.JdbcTemplate.query (JdbcTemplate.java: 455)
at org.springframework.jdbc.core.JdbcTemplate.query (JdbcTemplate.java: 463)
at impl.StudentImpl.getStudent (StudentImpl.java: 39)
at operaDb.Test.main (Test.java: 22)
---------------------------------------------- ----
which StudentImpl.java the relevant code is as follows :
@ Override
public List
List
@ Override
public Student mapRow (ResultSet rs, int arg1) throws SQLException {
Student s = new Student ();
s.setsId (rs.getString ("sId"));
s.setsName (rs.getString ("sName"));
s.setsAge (rs.getInt ("sAge"));
return s;
}
});
return studentList;
}
applicationcontext.xml documents relevant code is as follows: ,
Test.java class -related code is as follows :
public static void main (String [] args) {
ApplicationContext a = new FileSystemXmlApplicationContext ("D: \ \ myPrj \ \ myWebSpring \ \ WebRoot \ \ WEB-INF \ \ applicationContext.xml");
StudentDao s = (StudentDao) a.getBean ("zhou");
System.out.println (s.getStudent ());
}
------ Solution ------------------------------------ --------
This value was wrong now !
------ Solution ------------------------------------ --------
jdbc: mysql :/ / localhost: 3306/spring
is : No, it
没有评论:
发表评论