Configure as follows: data-source> data-Sources> call method is: import java.sql.datasource; DataSourece DS = (DataSource) servlet.getServletContext (). GetAttribute ("org.apache.struts .action.data_source "); connection conn = ds.getConnection (); preparedStatement PSTMT = conn.preparestatement (" select * from test "); ResultSet RS = pstmt.executeQuery () This is OK.