Hi,
i used spring framework jdbctemplate,its working but some times it throws exception in DriverManager connection exception.
Oracle10g database.I used SpringConfig.xml for read the database.I put this xml in WEB-INF/classes/SpringConfig.xml.
did any one face this paroblem?what is the solution?please help me.
public Collection findAll() throws RemoteException {
ApplicationContext ctx=new ClassPathXmlApplicationContext("SpringConfig.xml") ;
dataSource = (DataSource)ctx.getBean("mydataSource");
JdbcTemplate jt = new JdbcTemplate(dataSource); String sql = "select EMPID,FIRSTNAME,LASTNAME from EMPLOYEE order by FIRSTNAME";
return jt.query(sql,new EmployeeTOMapper());
}
public class EmployeeTOMapper implements RowMapper {
public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
Integer empId = new Integer(rs.getInt("EMPID"));
String FirstName = rs.getString("FIRSTNAME");
String LastName = rs.getString("LASTNAME");
Employee empTo = new Employee(empId,FirstName,LastName);
return empTo;
}
}
Error Occur in this line
return jt.query(sql,new EmployeeTOMapper());
org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC Connection; nested exception is java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=1 2519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))
Caused by: java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=169869568)(ERR=1 2519)(ERROR_STACK=(ERROR=(CODE=12519)(EMFI=4))))
please help me..
Thanks in advance
Mahe


Reply With Quote