1 jsp与数据库的连接
<%Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection C = DriverManager.getConnection("jdbc:mysql://localhost/bookbar?user=root&password=123456&useUnicode=true&characterEncoding=8859_1");
Statement s = C.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = s.executeQuery("select * from mc_stk_mas");
%>
//其中jdbc的驱动是将mysql-connector-java- 3.1.12 -bin.jar 文件拷贝到
WEB_INF/lib的下面
//剩下的部分,改变的为localhost/bookbar(数据库) &password=.. mc_stk_mas为该数据库里的一个表