Servlet连接oracle://1.仔细检查连接串。//2.确认有没有这个表。//3.如果出错了,先去后台看报错的信息。//4.确认oracle已经启动了。//5.把oracle的驱动D:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar拷贝到D:\Tomcat5.5.17\webapps\my\WEB-INF\lib。(因为运行时需要该jar包)import Java.io.*;import Java.sql.*;public class ShowRs extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Connection conn = null; Statement stmt = null; ResultSet rs = null; response.setContentType("text/html"); response.setCharacterEncoding("gb2312"); PrintWriter out = response.getWriter(); out.println("
Content: |
" + rs.getString("ename") + " | "); out.println("