我这样为什么不行?
RT...原来的代码是这样的:
<%
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/data00?user=root&password=123456&useUnicode=true&characterEncoding=GB2312");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "SELECT * FROM notes";
.....
为了方便,我将其中一段另存为一个单独的文件
con.jsp :
<%
Connection con = null;
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/data00?user=root&password=123456&useUnicode=true&characterEncoding=GB2312");
%>
原代码改为:
<jsp:include page="conn.jsp" flush="true" />
<%
Statement stmt = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String query = "SELECT * FROM notes";
...
但是为什么运行时要报错呢?
请大家帮忙指点指点
[此贴子已经被作者于2007-6-5 10:12:07编辑过]